class Solution {

public:

```
bool isPalindrome(int x) {
if (x < 0) return false;
int result = 0;
int oldx = x;
while(x > 0){
int a = x % 10;
x = x/10;
if ((INT_MAX - a)/10 < result) return false;
result = result * 10 + a;
}
if (result == oldx)
return true;
return false;
}
```

};