```
bool isPalindrome(int x) {
if(x < 0) return false;
int a = 1;
int len = 1;
int temp = x/10;
while(temp != 0) {
a *= 10;
temp /= 10;
++len;
}
len /= 2;
int x1 = x;
while(len > 0) {
if(x1/a != x%10) return false;
x1 %= a;
a /= 10;
x /= 10;
--len;
}
return true;
}
```

Basically get the length of the number, and largest tens.