4ms CPP extremely simple codes


  • -1
    L

    uint32_t reverseBits(uint32_t n) {

        uint32_t m;
        for(int i=0;i<32;i++){
            m=(m<<1)|((n%2)?0x0001:0);
            n=n>>1;
        }
        return m;
    

    }


Log in to reply
 

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