Iterate for each index of bit [ ] array from 31 to 0 , and check if the ith value of bit array is 0
for i in range ( 31 , - 1 , - 1 ) : NEW_LINE INDENT if ( bit [ i ] == 0 and k > 0 ) : NEW_LINE INDENT temp = build_num ( bit ) NEW_LINE temp1 = temp NEW_LINE val = - 1 NEW_LINE for j in range ( 0 , n ) : NEW_LINE DEDENT DEDENT