Use two pointers concept, find the half point, and compare first half and 2nd half.

Variable ** revhalf** is the reversed 2nd half(x has even number of digits), or 2nd half with the middle digit(if x has odd number of digits)

```
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0) return false;
int revhalf = 0, slow = x, fast = x;
while(fast){
revhalf = revhalf * 10 + slow % 10;
slow /= 10;
fast /= 100;
}
return slow == revhalf || slow == revhalf / 10;
}
};
```