Reverse Bits (C)


  • 0
    P
    uint32_t reverseBits(uint32_t n) {
        uint32_t m = 0;
        for(int i=0; i<32; i++)
            m = m|(((n>>i)&1)<<(31-i));
        return m;
    }

Log in to reply
 

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