class Solution:
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
s = str(x)
N = len(s)
for i in range(int(N/2)):
if s[i] != s[N-i-1]:
return False
return True
Python, LeetCode, 9. 回文数
最新推荐文章于 2022-09-03 21:14:45 发布