- C++
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0){
return false;
}
int temp = x;
int y = 0;
while(temp > 0){
y *= 10;
y += temp % 10;
temp /= 10;
}
return (x == y)? true:false;
}
};