Iterate for each index of bit [ ] array from 31 to 0 , and check if the ith value of bit array is 0
for ( let i = 31 ; i >= 0 ; i -- ) { if ( bit [ i ] == 0 && k > 0 ) { let temp = build_num ( bit ) ; let temp1 = temp ; let val = - 1 ; for ( let j = 0 ; j < n ; j ++ ) {