Dorothydu's picture
Add files using upload-large-folder tool
24a2c4d verified
class Solution:
def reverseBits(self, n: int) -> int:
ans, pow = 0, 31
while n > 0:
ans += (1 & n) << pow
pow -= 1
n >>= 1
return ans