Palindrome Number

2019-05-25 22:59:02 浏览数 (2)

1. Description

2. Solution

代码语言:javascript复制
class Solution {
public:
    bool isPalindrome(int x) {
        if(x < 0) {
            return false;
        }
        int m = x;
        int y = 0;
        while(m) {
            y = y * 10   m % 10;
            m /= 10;
        }
        return x == y;
    }
};

0 人点赞