LeetCode--整数反转 Xieyuw 2020-04-11 算法学习 [7]:整数反转题目:https://leetcode-cn.com/problems/reverse-integer/description/ 解题:看别人的代码不得不感慨! 太强了!! 代码:123456789101112class Solution {public: int reverse(int x) { long ans = 0; while(x) { ans = ans * 10 + x % 10; x /= 10; } return ans > 2147483647 || ans<-2147483648? 0:ans; }}; updated at Apr 11, 2020 数学 Previous LeetCode--回文数 数学 Next LeetCode--两数之和 hash-table