leetcode-----9. 回文数

代码

class Solution {
    public boolean isPalindrome(int x) {
        if (x < 0 || (x % 10 == 0 && x != 0)) return false;
        int s = 0;
        while (s <= x) {
            s = s * 10 + x % 10;
            if (s == x || s == x / 10) return true;
            x /= 10;
        }   
        return false;
    }
}
原文地址:https://www.cnblogs.com/clown9804/p/13031934.html