class Solution: # @return an integer def reverse(self, x): if x >= 0 : return int(str(x)[::-1]) else: return -1*int(str(-1*x)[::-1])
Submission Result: Wrong Answer
- Input: 1534236469
- Output: 9646324351
- Expected: 0
No, this is not a bug. You should return 0 when the reversed integer overflow. And the reversed integer of given input will overflow. So the expected output is 0.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.