
代码 :
class Solution {public:bool isPalindrome(int x) {if(x < 0) return false;long long res = 0;int tmp = x;while(x) {res = res * 10 + x % 10;x /= 10;}return tmp == res;}};
class Solution {public:bool isPalindrome(int x) {string res = to_string(x);auto s = res;reverse(res.begin(), res.end());return res == s;}};
