C solution,it's an easy problem,but how can it run faster?


  • 0
    D
    uint32_t reverseBits(uint32_t n) {
    uint32_t ret = 0;
    for(int i=0 ;i<=31;i++){
    ret+=((n & (1<<i))>>i)<< (31-i);
    }
    return ret;
    

    }


Log in to reply
 

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