Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, December 10, 2016

Codefights mirrorBits


//sample solution

function reverseBits(a) {
    return a.split("").reverse().join("");
}

function changeToBinary(a){
    return (a >>> 0).toString(2);
}

function changeToDecimal(a){
    return parseInt(a,2);
}

function mirrorBits(a) {
    return changeToDecimal(reverseBits(changeToBinary(a)));
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts