Determine whether an integer is a palindrome. Do this without extra space.
class Solution
{
public:
bool isPalindrome(int x)
{
if(x < 0)
return false;
int org = x;
int temp=0;
while(x>0)
{
temp = temp*10 + x%10;
x = x/10;
}
if(temp == org)
return true;
return false;
}
};原文地址:http://blog.csdn.net/shaya118/article/details/42525175