L LeetCode 2016-08-09 LeetCode 7: Reverse integer LeetCode Math Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321. 代码1234567891011int reverse(int x) { int res = 0; while (x != 0) { if (res > INT_MAX/10 ||res < INT_MIN/10) { return 0; } res = x % 10 + res * 10; x /= 10; } return res;} 下一篇 LeetCode 50: Pow(x, n) 上一篇 LeetCode 12: Integer to Roman