leetcode
This commit is contained in:
11
leetcode/190.py
Normal file
11
leetcode/190.py
Normal file
@@ -0,0 +1,11 @@
|
||||
class Solution:
|
||||
def reverseBits(self, n: int) -> int:
|
||||
r=""
|
||||
b=bin(n)
|
||||
|
||||
for i in range(1,32+1):
|
||||
if i>len(b)-2:
|
||||
r+="0"
|
||||
else:
|
||||
r+=b[-i]
|
||||
return int(r,2)
|
||||
Reference in New Issue
Block a user