Function to convert decimal number n to its binary representation stored as an array arr [ ]
function decBinary ( arr , n ) { let k = Math . log2 ( n ) ; while ( n > 0 ) { arr [ k -- ] = n % 2 ; n = Math . floor ( n / 2 ) ; } }