
728x90
import java.util.*;
class Solution {
public int solution(int[] citations) {
List<Integer> sort = new ArrayList<>();
for (int i : citations){
sort.add(i);
}
int hDex = 0;
sort.sort(Collections.reverseOrder());
for (int i = 0; i< sort.size(); i++){
if (sort.get(i)>=i+1){
hDex = i +1;
}
if (sort.get(i)<i+1) break;
}
return hDex;
}
}
728x90
반응형
'알고리즘' 카테고리의 다른 글
하샤드수(Lv.1)[프로그래머스] (0) | 2022.09.27 |
---|---|
최댓값과 최솟값(Lv.2)[프로그래머스] (0) | 2022.09.24 |
[1차]캐시 2018 KAKAO BLIND RECRUITMENT(Lv.2)[프로그래머스] (0) | 2022.09.22 |
야근지수(Lv.3)[프로그래머스] (2) | 2022.09.21 |
이중우선순위큐(Lv.3)[프로그래머스] (0) | 2022.09.20 |