C++ 4 lines 4 ms


  • 10
    J
    uint32_t reverseBits(uint32_t n) {
        uint32_t m = 0;
        for (int i = 0; i< 32 ; i++,n/=2)
            m = (m<<1) + (n%2);
        return m;
    }

Log in to reply
 

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