1.描述
Determine whether an integer is a palindrome. Do this without extra space.
2.分析
3.代码
bool isPalindrome(int x) {
if (0 > x) return false;
if (10 > x) return true;
long long m = x;
long long n = 0;
while (0 != m) {
n = n* 10 + m % 10;
m /= 10;
}
m = x;
while (0 != m && 0 != n) {
if (m %10 != n % 10) return false;
m /= 10;
n /= 10;
}
return true;
}