Basically eating away the digits from left and right.

Corner cases, x<0 and x has a lot of zeros in left half of the number handled.

class Solution {

public:

bool isPalindrome(int x) {

if(x<0){return false;}

while(x>9)

{

if(x/(int)(pow(10,floor(log(x)/log(10))))!=(x%10))

{

return false;

}

if((x%((int)(pow(10,floor(log(x)/log(10))))))<((int)(pow(10,floor(log(x)/log(10))-1))))

{

x=x+((int)(pow(10,floor(log(x)/log(10))-1)))+10;

}

x=(x%((int)(pow(10,floor(log(x)/log(10))))))/10;

}

return true;

}

};