class Solution {
public:
bool isPalindrome(int x) {
int res = 0 ;
int temp = x;
while(temp){
res = res* 10 + temp%10;
temp /= 10;
}
return (x >= 0 && x == res);
}
};```
My C++ Solution easy to understand

@lapcace said in My C++ Solution easy to understand:
class Solution { public: bool isPalindrome(int x) { int res = 0 ; int temp = x; while(temp){ res = res* 10 + temp%10; temp /= 10; } return (x >= 0 && x == res); } };