I compress it into 4 lines lol, it is an O(n) solution if Arrays.sort() is not consider

```
public int hIndex(int[] citations) {
Arrays.sort(citations);
int len = citations.length, h = 0;
for (int i = len - 1; i >= 0; i--) {if (citations[i] >= len - i) {h++;}}
return h;
}
```

the more readable version

```
public int hIndex(int[] citations) {
if (citations == null || citations.length == 0) {return 0;}
Arrays.sort(citations);
int len = citations.length, h = 0;
for (int i = len - 1; i >= 0; i--) {
if (citations[i] >= len - i) {
h++;
}
}
return h;
}
```