/**
* @param {number} x
* @return {number}
*/
var reverse = function (x) {
let res = 0;
while (x != 0) {
res = res * 10 + (x % 10);
// 划重点
x = ~~(x / 10);
if (res < Math.pow(-2, 31) || res > Math.pow(2, 31) - 1) {
return 0;
}
}
if (x >= 0) {
return res;
}
return -res;
};
标签:10,return,题解,number,res,pow,LeetCode,反转 From: https://www.cnblogs.com/wangshaojiea/p/16773200.html本文由一文多发运营工具平台 EaseWriting 发布