代码实现:
借鉴了一个极妙的方法,反转后两数相等
bool isPalindrome(int x){
if(x<0)
return false;//直接杀死负数
long y=0;
int temp=x;
while(temp!=0){
y=y*10+temp%10;
temp/=10;
}
if(y==x)
{
return true;
}
return false;
}