9. [栈]回文数
9. 回文数
// 执行耗时:9 ms,击败了99.19% 的Java用户
// 内存消耗:38.2 MB,击败了62.03% 的Java用户
class Solution {
public boolean isPalindrome(int x) {
if (x < 0){
return false;
}
int res = 0, raw_x = x;
while (raw_x != 0){
res = res * 10 + raw_x % 10;
raw_x /= 10;
}
return x == res;
}
}

浙公网安备 33010602011771号