Increment count of numbers having MSB at log ( arr [ i ] )
if ( freq . has ( parseInt ( Math . log2 ( arr [ i ] ) ) ) ) { freq . set ( parseInt ( Math . log2 ( arr [ i ] ) ) , freq . get ( parseInt ( Math . log2 ( arr [ i ] ) ) ) + 1 ) ; } else { freq . set ( parseInt ( Math . log2 ( arr [ i ] ) ) , 1 ) ; } }