数学
class Solution {
public:
/**
*
* @param x int整型
* @return bool布尔型
*/
bool isPalindrome(int x) {
// write code here
if(x < 0) return false;
int ans = 0;
while(x > ans){
ans = ans * 10 + x % 10;
x /= 10;
}
return ans == x || ans / 10 == x;
}
}; 
京公网安备 11010502036488号