Skip to content

Commit 9a50004

Browse files
authored
Merge pull request #125 from ashwek/Reverse
0190 Reverse Bits - Python
2 parents b362bb8 + b505bc8 commit 9a50004

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Solution:
2+
# @param n, an integer
3+
# @return an integer
4+
def reverseBits(self, n):
5+
B = bin(n)
6+
B = (B[2:].rjust(32, "0"))[::-1]
7+
return int(B, 2)

0 commit comments

Comments
 (0)