We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e332bc commit 33f2a5eCopy full SHA for 33f2a5e
reverse-bits/devyejin.py
@@ -0,0 +1,6 @@
1
+# time complexity O(1)
2
+class Solution:
3
+ def reverseBits(self, n: int) -> int:
4
+ binary = bin(n)[2:].zfill(32)
5
+ reversed_binary = binary[::-1]
6
+ return int(reversed_binary, 2)
0 commit comments