Practice/Microsoft/Leetcode 274. H-Index
CodingOptional
You are evaluating the research impact of a scientist based on their publication citation counts. The impact score is defined as the maximum value s such that the researcher has at least s papers that have each been cited at least s times.
Given an array of integers citations where citations[i] represents the number of citations the i-th paper has received, return the researcher's impact score.
s where at least s papers have s or more citations0 <= citations.length <= 50000 <= citations[i] <= 1000Example 1:
Input: citations = [3, 0, 6, 1, 5] Output: 3 Explanation: The researcher has 5 papers in total. 3 of them have at least 3 citations each (the papers with 3, 6, and 5 citations), while the remaining 2 have fewer than 3 citations. Therefore, the impact score is 3.
Example 2:
Input: citations = [1, 3, 1] Output: 1 Explanation: The researcher has 3 papers. Only 1 paper has at least 2 citations, so we cannot achieve an impact score of 2. However, all papers have at least 1 citation, giving an impact score of 1.
Example 3:
Input: citations = [100] Output: 1 Explanation: The researcher has only 1 paper with 100 citations, so the maximum impact score is 1 (limited by the number of papers).