```
class Solution {
public:
bool isPalindrome(int x) {
if (x < 0 )
return false;
int result = x;
unsigned long temp = 0;
for( ; x; x /= 10 )
{
temp = 10 * temp + x % 10;
if( temp > INT_MAX )
return false;
}
return temp == result;
}
};
```