9. Palindrome Number
判断回文数
1 class Solution(object): 2 def isPalindrome(self, x): 3 """ 4 :type x: int 5 :rtype: bool 6 """ 7 if x<0: 8 return False 9 y = int(str(abs(x))[::-1]) 10 if x == y: 11 return True 12 else: 13 return False
结果:Accepted,虽然本来就是easy难度的,但仍然感觉用python写好赖皮
时间: 2024-10-04 23:29:43