Determine whether an integer is a palindrome. Do this without extra space.
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0) return false;
string a = "";
while(x)
{
a += x % 10 + '0';
x /= 10;
}
string b(a);
reverse(a.begin(), a.end());
return a == b;
}
};