c++:
class Solution {
public:
bool isPalindrome(int x) {
if(x<0) return false;
std::string str = std::to_string(x);
for(std::string::iterator i = str.begin(), j = str.end()-1; i < j; i++, j--){
if(*i != *j)
return false;
}
return true;
}
};