C solution with 5ms


  • 1
    H
    uint32_t reverseBits(uint32_t n) {
    	unsigned int result = 0;
    	int index;
    	for(index = 0; index < 32; index++) {
    		result = result * 2 + n % 2;
    		n = n / 2;
    	}
    
    	return result;
    }

Log in to reply
 

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