代码:
class Solution {
public:
bool isPalindrome(int x) {
if(x < 0) return false;
long long res = 0;
int tmp = x;
while(x){
res = res * 10 + x % 10;
x /= 10;
}
return res == tmp;
}
};
评论区