Palindrome Number
Desicription
Determine whether an integer is a palindrome. Do this without extra space.
Solution
代码语言:javascript复制class Solution {
public:
bool isPalindrome(int x) {
stringstream stream;
string res;
stream << x;
stream >> res;
for(int i = 0, j = res.size()-1; i <= j; i , j--){
if(res[i] != res[j])
return 0;
}
return 1;
}
};