腹泻 难受
我好菜,我就是来水文章的
Given an integer x, return true if x is palindrome integer.
An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not.
class Solution {
public:
bool isPalindrome(int x) {
if(x<0)
return false;
else
{
long n=0;
int k=x;
while(k!=0)
{
n=n*10+k%10;
k=k/10;
}
if(n==x)
return true;
else
return false;
}
}
};
很蠢的做法,本来只要回文一半就可以做出来