Runtime: 476 ms, faster than 29.19% of Python3 online submissions for Palindrome Number.
显然 跟第七题一样
首先按照题意
- 负数没有回文数
- 一个数的回文数必然等于自己
class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0 :
return False
else:
y = str(x)
sum = ''
for i in (str(y)):
sum = i + sum
if sum == y:
return True
else:
return False