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

int smallest_index(int[] arr)
{
  foreach(i;0..arr.length) if(i % 10 == arr[i]) return cast(int)i;
  return -1;
}

void main()
{
  int[] arr1 = [0,1,2];
  int[] arr2 = [4,3,2,1];
  int[] arr3 = [1,2,3,4,5,6,7,8,9,0];
  writeln(smallest_index(arr1));
  writeln(smallest_index(arr2));
  writeln(smallest_index(arr3));
}