L LeetCode 2016-08-08 LeetCode 9: Palindrome Number LeetCode Math Determine whether an integer is a palindrome. Do this without extra space. 代码123456789101112bool isPalindrome(int x) { if (x < 0 || (x!=0 && x%10==0)) { return false; } int sum = 0; while (x > sum) { sum = sum*10 + x%10; x /= 10; } return (x==sum)||(x==sum/10); } 下一篇 LeetCode 319: Bulb Switcher 上一篇 LeetCode 231: Power of Two