From : https://leetcode.com/problems/palindrome-number/
Determine whether an integer is a palindrome. Do this without extra space.
class Solution {
public:
bool isPalindrome(int x) {
if(x<0) return false;
unsigned int t=x, low=1, high=1;
while(t/10) { high *= 10; t /= 10; }
while(low < high) {
if(x/high%10 != x/low%10) return false;
low *= 10;
high /= 10;
}
return true;
}
};