aboutsummaryrefslogtreecommitdiff
path: root/challenge-207/deadmarshal/d/ch2.d
blob: 3dc2974bada6977fefa008db164d3aee037a5006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import std.stdio:writeln;

int h_index(int[] arr)
{
  int ret = 0;
  for(int i = 0; i < arr.length; ++i)
    if(i >= arr[i])
    {
      ret = i;
      break;
    }
  return ret;
}

void main()
{
  writeln(h_index([10,8,5,4,3]));
  writeln(h_index([25,8,5,3,3]));
}