Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Hsinha11/Leetcode-solutions
/ reverseBits
Method
reverseBits
190-reverse-bits/reverse-bits.py:4–9 ·
view source on GitHub ↗
(self, n: int)
Source
from the content-addressed store, hash-verified
2
3
class
Solution:
4
def
reverseBits(self, n: int) -> int:
5
result = 0
6
for
_ in range(32):
7
result = (result << 1) | (n & 1)
8
n >>= 1
9
return
result
Callers
nothing calls this directly
Calls
no outgoing calls
Tested by
no test coverage detected