leetcode---274.H指数
作者:互联网
class Solution:
def hIndex(self, citations):
if len(citations)==1:
if citations[0]==1:
return 1
if citations[0]==0:
return 0
citations.sort(reverse=-1)
h=0
for i in range(len(citations)):
if citations[i]<i+1:
h=i
break
if citations[-1]>=len(citations):
return len(citations)
return h
标签:sort,return,reverse,self,len,---,citations,274,leetcode 来源: https://blog.csdn.net/m0_46384757/article/details/122382588