class Solution {

public:

bool isPalindrome(int x) {

if(x<0)

return false;

if( x < 10)

return true;

int target = 0;

int orgin = x;

while(orgin != 0){

target = target * 10 + orgin % 10;

orgin /= 10;

}

return target == x;

}

};

negative number is not palindrome. Reverse the given number and compare.