aboutsummaryrefslogtreecommitdiff
path: root/challenge-207/deadmarshal/pascal/ch2.pas
blob: 8f54f5ea5a4fa62afc36f096ca4cf2ab12a333cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
program Ch2;

{$mode objfpc}

uses
  SysUtils,Types;

function HIndex(A:TIntegerDynArray):Integer;
var
  I:Integer;
begin
  for I := Low(A) to High(A) do
    if(I >= A[I]) then Exit(I);
end;

begin
  WriteLn(HIndex([10,8,5,4,3]));
  WriteLn(HIndex([25,8,5,3,3]));
end.