标签:
Determine whether an integer is a palindrome. Do this without extra space.
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 10 m = 0 11 n = x 12 while( n != 0): 13 m = m * 10 + n % 10 14 n /= 10 15 16 if m == x: 17 return True 18 else: 19 return False 20 21
[LeetCode #9] Palindrome Number
标签:
原文地址:http://www.cnblogs.com/amadis/p/5925665.html