Find the Largest Supported Citation Threshold
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
### Problem
Return the largest integer h for which at least h papers each have at least h citations. citations contains one nonnegative count per paper.
```cpp
int hIndex(vector<int>& citations);
```
### Examples
```text
citations = [4,0,4,2,1] -> 2
citations = [0,0] -> 0
```
### Constraints
- There are 1 through 5000 papers.
- Each citation count is in [0,1000].
Overview: Find the Largest Supported Citation Threshold. Return the largest integer h for which at least h papers each have at least h citations. citations contains one nonnegative count per paper.