Skip to content

Commit 8fb92b4

Browse files
authored
Create 190-Reverse-Bits.py
1 parent b7f9333 commit 8fb92b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

190-Reverse-Bits.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
def reverseBits(self, n: int) -> int:
3+
res = 0
4+
for i in range(32):
5+
bit = (n >> i) & 1
6+
res = res | (bit << (31 - i))
7+
return res

0 commit comments

Comments
 (0)