Solve as a string with bin()

```
class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
res=bin(n).replace('0b','')
res='0'*(32-len(res))+res
res=res[::-1]
return int(res,2)
```

Solve with bit operators

```
class Solution:
# @param n, an integer
# @return an integer
def reverseBits(self, n):
res=0
for i in range(32):
res+=(n>>i&1)<<(31-i)
return res
```