赞
踩
Given an array of integers citations where citations[i] is the number of citations a researcher received for their ith paper, return the researcher’s h-index.
According to the definition of h-index on Wikipedia: The h-index is defined as the maximum value of h such that the given researcher has published at least h papers that have each been cited at least h times.
Sort the citations by the reverse order and calculate the h-index.
class Solution:
def hIndex(self, citations: List[int]) -> int:
clen = len(citations)
citations.sort(reverse = True)
n = 0
while n < clen and citations[n] >= n+1:
n += 1
return n
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。