Fill the remaining elements of answer
j = 0 NEW_LINE for i in range ( 0 , n ) : NEW_LINE INDENT if ans [ i ] == 0 : NEW_LINE INDENT ans [ i ] = Ap [ remain [ j ] ] [ 0 ] NEW_LINE j += 1 NEW_LINE DEDENT DEDENT