```
class Solution {
public:
bool isPalindrome(int x) {
if(x<0)
return false;
int dc=0, t=x, temp=0; //dc is for digit count in x
while(t){ //counting no of digits in x
dc++;
t /=10;
}
for(int i=0;i<dc/2;i++){ //just traverse half of digit and create a new number with dc/2 digits only
temp = 10*temp+x%10;
x /=10;
}
if(dc%2)// if dc is odd drop one more digit from x
x /=10;
return x==temp;
}
};
```