public int reverse(int x) {
long res = 0;
while (x != 0){
res = res* 10 + x % 10;
x /= 10;
}
if(res >= Integer.MAX_VALUE || res < Integer.MIN_VALUE)
return 0;
return (int)res;
}
相关文章
- 10-27leetcode题解 7.Reverse Integer
- 10-27LeetCode-7 Reverse Integer
- 10-27【Leetcode】7.Reverse Integer
- 10-27leetcode 7-> Reverse Integer(32-bit signed integer)
- 10-27LeetCode 7. Reverse Integer
- 10-27leetcode-7. Reverse Integer
- 10-27leetcode Reverse Integer python
- 10-277. Reverse Integer(翻转整数)
- 10-27LeetCode 7 Reverse Integer int:2147483647-2147483648 难度:2
- 10-27[Leetcode]Reverse Integer