274. H-Index | LeetCode | Top Interview 150 | 코딩 질문
발행: (2025년 12월 16일 오전 09:13 GMT+9)
1 min read
원문: Dev.to
Source: Dev.to
솔루션
class Solution {
public int hIndex(int[] citations) {
int n = citations.length;
int[] arr = new int[n+1];
for (int i = 0; i n) {
arr[n]++;
} else {
arr[citations[i]]++;
}
}
int count = 0;
for (int i = n; i >= 0; i--) {
count += arr[i];
if (count >= i) {
return i;
}
}
return 0;
}
}