274 H指数

 

 

1 def hIndex(citations):
2     citations.sort()
3     n = len(citations)
4     index = 0
5     while index < n:
6         if n - index <= citations[index]:
7             break
8         index += 1
9     return n - index
1 def hIndex(citations):
2     citations += [0]  # 加个哨兵
3     print(citations)
4     citations.sort(reverse=True)  # 降序排列
5     for i, c in enumerate(citations):
6         if i + 1 > c:
7             return i

 

posted @ 2022-10-08 10:00  努力中的小菜鸟  阅读(38)  评论(0)    收藏  举报