0ms C code with loop 16 times


  • 1
    H
    uint32_t reverseBits(uint32_t n) {
        uint32_t i, ans=0;
    	for(i=0;i<16;i++)
    		ans=ans|(1<<i&n)<<(31-2*i)|(1<<(31-i)&n)>>(31-2*i);
    	return ans;
    }

Log in to reply
 

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