# [LeetCode]Palindrome Number

string来通用处理

class Solution {
public:
bool isPalindrome(int x) {
stringstream ss;
ss<<x;
string s;
ss>>s;
int i,j;
if(s.size()==1) return true;
i = s.size()/2-1;
if(s.size()&0x1)    //odd
j = i+2;
else
j = i+1;
while(i>=0&&j<s.size()&&s[i]==s[j])
--i,++j;
++i,--j;
if(j-i+1==s.size())
return true;
else
return false;
}
};

bool isPalindrome(int x) {
int y=0;
if(x<0) return false;
int x_old = x;
while(x){
y = 10 * y + x%10;
x = x/10;
}
return x_old==y;

}

/*Determine whether an integer is a palindrome. Do this without extra space.*/
bool isPalindrome(int x) {
if(x<0|| (x!=0 &&x%10==0)) return false;
int sum=0;
while(x>sum)
{
sum = sum*10+x%10;
x = x/10;
}
return (x==sum)||(x==sum/10);

}

#### leetcode09-Palindrome Number之Java版本

2016-08-02 17:03:56

#### Palindrome Number -- LeetCode

2014-03-16 04:06:06

#### LeetCode中Palindrome Number的C语言代码

2017-03-12 13:30:41

#### LeetCode9——Palindrome Number

2015-01-27 10:26:54

#### Leetcode Palindrome Number C++

2015-12-01 17:56:32

#### LeetCode_Easy心得：9. Palindrome Number （C语言）

2017-07-21 14:38:57

#### LeetCode9. Palindrome Number(Python)兼翻译

2017-02-09 11:27:23

#### 【LeetCode】9. Palindrome Number回文数判断

2016-03-30 20:57:46