# 【LeetCode OJ 009】Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.

Could negative integers be palindromes? (ie, -1)

If you are thinking of converting the integer to string, note the restriction of using extra space.

You could also try reversing an integer. However, if you have solved the problem "Reverse Integer", you know that the reversed integer might overflow. How would you handle such case?

public class Solution
{
public boolean isPalindrome(int x)
{
if(x<0)
return false;
int temp;
int m=x;
while(m>0)
{
temp=m%10;
m=m/10;
}
int sum=0;
for(int i:list)
{
sum=sum*10+i;
}
//比较是否相等即可判断
if(x==sum)
{
return true;
}
else
{
return false;
}
}
}


03-16 9906

08-02 851

03-12 295

01-27 2710

12-01 660

07-21 362

02-09 314