class Solution { public: /** * * @param x int整型 * @return bool布尔型 */
bool isPalindrome(int x) {
// write code here
string s = to_string(x);
for(int i = 0, j = s.size() - 1; i < j; i ++, j -- )
{
if(s[i] != s[j])
{
return false;
}
}
return true;
}
};

京公网安备 11010502036488号