```
bool isPalindrome(int x) {
if(x<0)
return false;
if(x<10)
return true;
int left=1;
while(x/left>=10)
left*=10;
int right=1;
while(left>right){
if(x/left%10==(x/right)%10){
left/=10;
right*=10;
}
else
return false;
}
return true;
}
```