/**
* @param {number} x
* @return {boolean}
*/
var isPalindrome = function (x) {
if (x < 0) {
return false;
}
let num = x;
let reverse = 0;
while (num != 0) {
reverse = reverse * 10 + (num % 10);
num = ~~(num / 10);
}
return reverse === x;
};
本文由一文多发运营工具平台 EaseWriting 发布