Problem Problem description Determine whether an integer is a palindrome. Do this without extra space. Python Implementation 12345678910111213141516 class : def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False y = 0 t = x while t > 0: y = y * 10 + (t % 10) t = t // 10 print(y) return x == y 赞微海报分享
近期评论