1 /// <summary> 2 /// Solution 3 /// 100/100 4 /// </summary> 5 /// <param name="X"></param> 6 /// <param name="A"></param> 7 /// <returns></returns> 8 public static int solution(int X, int[] A) 9 { 10 bool[] flagArr = new bool[X]; 11 for (int i = 0; i < A.Length; i++) 12 { 13 if (flagArr[A[i] - 1] == false) 14 { 15 flagArr[A[i] - 1] = true; 16 X--; 17 } 18 if (X == 0) 19 { 20 return i; 21 } 22 } 23 return -1; 24 }