Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- """
- 结果左移,原数右移,末尾相加!
- """
- # @param n, an integer
- # @return an integer
- def reverseBits(self, n):
- result = 0
- for i in xrange(32):
- result <<= 1
- result |= n & 1
- n >>= 1
- return result
Add Comment
Please, Sign In to add comment