You are viewing a single comment's thread. Return to all comments →
javascript solution
function main() { const n = parseInt(readLine().trim(), 10); let max = 0 let nbin = n.toString(2) //5=101, 13=1101 let binnum = nbin.split(0) for(let i=0; i<binnum.length; i++){ if(max<binnum[i].length){ max = binnum[i].length } } console.log(max) }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
javascript solution