9. Palindrome Number
# Easy
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0:
return False
x2 = 0
temp = x
while temp != 0:
x2 = x2*10 + temp%10
temp = temp//10
if x2 == x:
return True
else:
return False
Last updated
Was this helpful?