🔗 H-Index
import java.util.Arrays;
class Solution {
public int solution(int[] citations) {
Arrays.sort(citations); // 오름차순 정렬
int n = citations.length;
for (int i = 0; i < n; i++) {
// 개수
int h = n - i;
// 인용 횟수
int count = citations[i];
// 인용 횟수가 h편 이상이라면
if (citations[i] >= h) {
return h;
}
}
return 0;
}
}
'코딩테스트 > 문제풀이' 카테고리의 다른 글
[ 프로그래머스 ] #42839 : 소수 찾기 - JAVA (0) | 2025.04.14 |
---|---|
[ etc ] #15 : 요세푸스 문제 - JAVA (0) | 2025.04.12 |
[ 프로그래머스 ] #81303 : 표 편집 - JAVA (0) | 2025.04.05 |
[ 프로그래머스 ] #42587 : 프로세스 - JAVA (1) | 2025.04.05 |
[ 프로그래머스 ] #42583 : 다리를 지나는 트럭 - JAVA (1) | 2025.04.03 |