Determine whether an integer is a palindrome. Do this without extra space.
class Solution
{
public:
bool isPalindrome(int x)
{
if(x < 0) return false;
if(x < 10) return true;
int y = 0;
int tmp = x;
while(x)
{
y = y*10 + x % 10;
x = x/ 10;
}
if(tmp == y) return true;
return false;
}
};