The z-index is a metric that measures both the productivity and citation impact of a researcher.
Specifically, a researcher's z-index is the largest number z such that the researcher has published
z papers that have each been cited at least z times.
For example, if Amy has published papers
A, B, C, D, E, F, G, H, I, which have been cited 1, 4, 1, 4, 2, 1, 3, 5, 6 times, respectively,
then her z-index is 4 (corresponding to papers B, D, H, I).
Design an algorithm that determines a researcher's z-index, then discuss the time and space complexity of your algorithm.
[3, 1, 2] -> z is 2
[1, 4, 1, 4, 2, 1, 3, 5, 6] -> z is 4
Hope it helps someone.