Skip to content

Commit c784f39

Browse files
committed
feat: Solve revser-bits problem
1 parent aedf76f commit c784f39

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

reverse-bits/hu6r1s.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
"""
3+
binary로 변환 후 zfill로 32자리를 맞춰주고 reverse시킨다.
4+
"""
5+
def reverseBits(self, n: int) -> int:
6+
return int(bin(n)[2:].zfill(32)[::-1], 2)

0 commit comments

Comments
 (0)