class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False x=str(x) i=0 j=len(x)-1 while i < j: if x[i] != x[j]: return False i+=1 j-=1 return True
时间: 2024-10-11 21:22:30
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False x=str(x) i=0 j=len(x)-1 while i < j: if x[i] != x[j]: return False i+=1 j-=1 return True