classSolution:defisPalindrome(self, x:int)->bool:"""
#数学方法1
if x < 0:
return False
s = 0
f = x
while x > 0:
s = s * 10 + x % 10
x //= 10
return s == f
#字符串方法
return str(x) == str(x)[::-1]
"""#数学方法2if x <0or(x %10==0and x !=0):returnFalse
s =0while x > s:
s = s *10+ x %10
x //=10return s == x or s //10== x