class Solution {
public int hIndex(int[] citations) {
// 给定的数组是非负整数,求其H
// h篇 >= h次 && N-h篇 <= h次
Arrays.sort(citations); // 原数组排序,论文引用次数按照从小到大来排序
int i = 0;
while(i < citations.length && citations[citations.length - i - 1] > i){
i++;
}
return i;
}
}
该方法来自leetcode官方