public class Solution { public int hIndex(int[] citations) { int size=citations.length; int answer=0; int[] res=new int[size+1]; //对于res数组进行初始化 for(int i=0;i<=size;i++) res[i]=0; //进行遍历 填充数组 for(int i=0;i<=size;i++) { for(int j=0;j<size;j++) { if(citations[j]>=i) res[i]++; } if(res[i]>=i) answer=i; } return answer; } }