H-Index
InterviewTime limit1sMemory limit512 MB
Given the citation counts of n papers, find the largest H such that at least H papers have at least H citations each.
- Level
Medium4 of 10
- Topics
- Sorting, Array, Greedy, Binary search
- Solved
- No attempts yet
Problem
In research, it is tough to determine how good of a researcher you are. One way that people determine how good you are is by looking at your -Index.
Each paper has a certain number of citations. Your -Index is the largest number such that you have papers with at least citations. Given the number of citations on each paper you have written, what is your -Index?
Input
The first line of input contains a single integer (), which is the number of papers you have written.
The next lines describe the papers. Each of these lines contains a single integer (), which is the number of citations that this paper has.
Output
Display your -Index.