原题链接: https://oj.leetcode.com/problems/palindrome-number/
非常非常简单的一道题。。。
class Solution {
public:
bool isPalindrome(int x) {
if (x < 0) return false;
int ori = x;
int rev = 0;
while (x) {
rev = rev * 10 + x % 10;
x /= 10;
}
return (ori == rev);
}
};[Leetcode] 9 - Palindrome Number
原文:http://blog.csdn.net/algorithmengine/article/details/42494055