9. Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space.
Solution:
class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x != 0 and x % 10 == 0:
return False
left = x
right = 0
while left > right:
right = right * 10 + left % 10
left /= 10
return left == right or left == right / 10