```
class Solution {
public:
bool isPalindrome(int x) {
if( x < 0) return false;
if( x / 10 == 0) return true;
int base = 1;
while(x/base >= 10){
base = base*10;
}
while(x > 0){
int right = x%10;
int left = x/base;
if(right != left) return false;
x = (x - left*base)/10;
base /= 100;
}
return true;
}
};
```