Skip to content
loading...

re: Daily Challenge #152 - Strongest Number in an Interval VIEW POST

FULL DISCUSSION
 

Some JS oneliners!

g=n=>(n>>>0).toString(2).split`1`.pop().length

f=n=>{i=n[0],m=0;while(i<=n[1]){m=Math.max(m,g(i));++i}return m}

The g method takes a number, converts it to binary, and return the number of trailing zeroes. Then, the f method loops through the input interval in order to return the maximum power

code of conduct - report abuse