We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 786b5a4 commit 66d8dc5Copy full SHA for 66d8dc5
Python3/Reverse Integer.py
@@ -0,0 +1,6 @@
1
+class Solution:
2
+ def reverse(self, x: int) -> int:
3
+ l = list(str(abs(x)))
4
+ l.reverse()
5
+ rx = int("".join(l)) if x > 0 else -int("".join(l))
6
+ return rx if (rx < ((2 ** 31) - 1) and rx > -(2 ** 31)) else 0
0 commit comments