My simple Javascript solution


  • 0
    K
    var reverseBits = function(n) {
    
    var str=n.toString(2).split("").reverse().join("");
    while(str.length<32){
        str=str+'0';
    }
    console.log(str);
    return parseInt(str, 2);
    

    };


Log in to reply
 

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