LeetCode练习3——回文数

bool isPalindrome(int x) {
        if(x < 0)
            return false;

        long long n = 0;
        int m = x;
        while(0 != m)
        {
            n = n * 10 + m % 10;
            m = m / 10;
        }

        return x == n;
    }

你可能感兴趣的:(LeetCode题目,leetcode,算法,回文数)