My C 3ms solution


  • 1
    K
    uint32_t reverseBits(uint32_t n)
    

    {
    int i;
    unsigned int temp;
    unsigned int result = 0;

    for(i = 0; i<=31; i++)
    {
    temp = n&(1<<i);
    temp = temp>>i;
    temp = temp<<(31-i);
    result |= temp;
    }
    return result;
    }


Log in to reply
 

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