One line python solution 48ms


  • 0
    L
    class Solution(object):
    def reverseBits(self, n):
        """
        :type n: int
        :rtype: int
        """
        return int(('0'*(32-len(bin(n)[2:]))+bin(n)[2:])[::-1],2)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.