Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class Solution:
def isPalindrome(self, x: int) -> bool:
if x is None:
return False
if x<0:
return False
x = str(x)
res = True
# 左右対称かチェック、中央はチェック不要
for i in range(len(x)//2):
res = res and (x[i]==x[-1+-1*i])
return res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.