소스코드 

Map<Integer, Integer> xCnt = new HashMap();
int cntResult = -1;
for(int i = 0; i < A.length ; i ++){
	if(A[i] <= X){
		xCnt.put(A[i], 0);
		if(xCnt.size() == X){
			cntResult = i;
			break;
		}
	}
}

System.out.println(cntResult);

'공부-codility' 카테고리의 다른 글

[Lesson] 4. PermCheck  (0) 2022.08.08
[Lesson] 3. TapeEquilibrium  (0) 2022.08.04
[Lesson] 3. PermMissionElem  (0) 2022.08.04
[Lesson] 3. FrogJmp  (0) 2022.08.04
[Lesson] 2. Arrays - OddOccurrencesInArray  (0) 2022.08.04

+ Recent posts