My code:

```
MAXINT = 2**31
class Solution:
def reverse(self, x):
if x == 0:
return 0
sign = x / abs(x)
x /= sign
ret = 0
while x:
ret *= 10
ret += x % 10
x /= 10
if ret > MAXINT:
return 0
return ret * sign
```

And it costs 204 ms, but I found many Python solutions that uses much less time in the Runtime Distribution. So what method did you use to run faster (of course Python only :D) ?