H-Index LeetCode solution in Java

1
class Solution {
2
public int hIndex(int[] citations) {
3
int n = citations.length;
4
Arrays.sort(citations);
5
for (int i = 0; i < n; i++) {
6
int hlen = (n - 1) - i + 1;
7
if (citations[i] >= hlen) {
8
return hlen;
9
}
10
}
11
return 0;
12
}
13
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0