#include <string>
class Solution {
  public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     *
     * @param x int整型
     * @return bool布尔型
     */
    bool isPalindrome(int x) {
        // write code here
        string s = to_string(x);
        int ls = s.size();
        int l = 0, r = ls - 1;
        while (l <= r) {
            if (s[l] != s[r])
                return false;
            l++;
            r--;
        }
        return true;
    }
};

一、题目考察的知识点

字符串

二、题目解答方法的文字分析

直接转化成字符串会很快,然后两头遍历

三、本题解析所用的编程语言

c++