class Solution {
public:
bool isPalindrome(int x) {
int num=x;
if(x>=0)
{
int rev = 0;
while (x != 0) {
int pop=x%10;
x /= 10;
if (rev > INT_MAX/10 || (rev == INT_MAX / 10 && pop > 7)) return false;
if (rev < INT_MIN/10 || (rev == INT_MIN / 10 && pop < -8)) return false;
rev = rev * 10 + pop;
}
if(rev==num)
return true;
else
return false;
}
else
return false;
}
};