class Solution {
public:
bool isPalindrome(int x) {
if(x == 0) return true;
if(x < 0) return false;
double tem = 0;
int y =x;
while(x != 0)
{
tem = tem*10 + (x%10);
x = x/10;
if(tem > INT_MAX) return false;
}
if((int)tem == y ) return true;
return false;
}
};
53 - 9. 回文数
最新推荐文章于 2023-02-20 23:14:27 发布