翻转一半的数
class Solution {
public:
bool isPalindrome(int x) {
if (x == 0){
return true;
}
if (x < 0 || x % 10 == 0){
return false;
}
int revertedNum = 0;
while (x > revertedNum){
revertedNum = revertedNum * 10 + x % 10;
x = x/10;
}
// cout << x << " " << revertedNum << endl;
return x == revertedNum || x == revertedNum/10;
}
};