意外的簡單。
class Solution:
def hIndex(self, citations: List[int]) -> int:
sorted_list = sorted(citations, reverse=True)
ret = 0
for i,element in enumerate(sorted_list[:1000]):
curr = min(i+1, element)
if curr > ret:
ret = curr
return ret