Fill the zeros finally , between the ones and the twos
k = 0 NEW_LINE while c_0 > 0 : NEW_LINE INDENT if ( ans [ k ] == - 1 ) : NEW_LINE INDENT ans [ k ] = zeros [ - 1 ] NEW_LINE c_0 -= 1 NEW_LINE DEDENT k += 2 NEW_LINE DEDENT