435. H-Index
MediumSorting
citations[i] is the citation count of paper i. Print the h-index: the largest h such that h papers have at least h citations each.
Input format
Line 1: n Line 2: n citation counts
Output format
The h-index.
Example 1
Input
5 3 0 6 1 5
Output
3
Example 2
Input
3 1 3 1
Output
1
Constraints
1 ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.
Loading the MyLoginn IDE…