class Solution:
def isPalindrome(self, x: int) -> bool:
x =str(x)
left, right = 0, len(x)-1
while left < right:
if x[left] == x[right]:
left += 1
right -= 1
else:
return False
return True
力扣:9回文数
最新推荐文章于 2024-09-07 20:08:36 发布