class Solution: def isPalindrome(self, x: int) -> bool: a = x if a<0: return False else: num = 0 while(a!=0): temp = a%10 a = a//10 num = num*10+temp if num==x: return True else: return False
LeetCode 9、判断一个整数是否是回文数。回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
猜你喜欢
转载自www.cnblogs.com/Halo-zyh-Go/p/12307316.html
今日推荐
周排行