4ms accepted C solution


  • 0
    P

    uint32_t reverseBits(uint32_t n){

    uint32_t a=0, i, result=0;
    
    for(i=0; i<32; i++)
    {
    	result|= (n & (1<<i))>0?1<<(31-i):0<<(31-i);
    }
    return result;
    

    }


Log in to reply
 

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