Determine whether an integer is a palindrome. Do this without extra space.python
class Solution(object): def numLen(self, n): i = 1 while True: n /= 10 if n > 0: i += 1 else: break return i def pow(self, n): i = 1 r = 1 while i < n: r *= 10 i += 1 return r def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False if x < 10: return True n = x nlen = self.numLen(n) t = self.pow(nlen) i = 0 while i < (nlen / 2): if (x / t) % 10 != n % 10: return False n /= 10 t /= 10 i += 1 return True