Divide current array element until it reduces to 1
while ( res ) { if ( mp . has ( res ) ) { mp . set ( res , mp . get ( res ) + 1 ) ; } else { mp . set ( res , 1 ) ; } res = parseInt ( res / 2 ) ; } } var mx = 1 ;