Explanation: The idea is to use another array, index is the citation and value is the number of papers that has at least the citation. Since the h-index can only be n, the new array will only need the index to be at most n, thus the array size will only need n+1. Papers that have more than n citations will store in array[n].

Go through the array based on h index definition: array[i]>=i, find the max value of i.

```
public class Solution {
public int hIndex(int[] citations) {
if(citations == null || citations.length == 0) return 0;
int n = citations.length;
int[] num = new int[n+1];
for(int i=0; i<n; i++) {
if(citations[i]>n) num[n]++;
else num[citations[i]]++;
}
if(num[n]>=n) return n;
for(int i=n-1; i>=0; i--) {
num[i] += num[i+1];
if(num[i]>=i) return i;
}
return 0;
}
}
```