Calculate h-index

Write codeMedium18 minGoogle style

Your task

A researcher's h-index is the largest h such that they have at least h papers each cited at least h times. Given an array citations where citations[i] is the citation count of the i-th paper, return the h-index. Array length up to 5000; citation counts are non-negative.

Examples

h_index(citations: list[int]) -> int
Example 1
Inputh_index([3, 0, 6, 1, 5])
Output3