function t = backup_one ( n, u, t )

%*****************************************************************************80
%
%% BACKUP_ONE seeks the last 1 in the subarray U(1:T-1).
%
%  Licensing:
%
%    I don't care what you do with this code.
%
%  Modified:
%
%    16 July 2017
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, integer N, the full size of the U array.
%
%    Input, integer U(N), the array to be checked.
%
%    Input, integer T, a value between 1 and N; entries T
%    through N are to be ignored.
%
%    Output, integer T, the highest index in U, between 1 and T-1,
%    for which U is 1.  If no such value is found, T is -1.
%
  for i = t - 1 : -1 : 1
    if ( u(i) == 1 )
      t = i;
      return
    end
  end

  t = -1;

  return
end
