cbangchen
11/11/2018 - 7:38 AM

9. Palindrome Number- Easy - 2018.10.30

class Solution {
public:
    bool isPalindrome(int x) {
        int xx = x;
        // 小于0直接false
        if (xx < 0) {
            return false;
        }
        int pa = 0;
        while (xx) {
            pa = pa * 10 + (xx % 10);
            xx /= 10;
        }
        return x == pa;
    }
};