This is my CPP solution.
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0){
return false;
}
long long int rev = 0;
long long int y = x;
while(y!=0){
long long int pop = y%10;
y/=10;
rev = rev*10 + pop;
}
if(rev == x){
return true;
}
return false;
}
};