class Solution {
public:
    /**
     * 
     * @param x int整型 
     * @return bool布尔型
     */
    bool isPalindrome(int x) {
        // write code here
        if(x < 0){
            return false;
        }
        
        int div = 1;
        while(x / div >= 10){
            div *= 10; 
        }
        int left, right;
        while(x > 0){
            left = x / div;
            right = x % 10;
            if(left != right){
                return false;
            }
            x = x%div;
            x = x/10;
            div = div/100;
        }
        return true;
    }
};