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

浙公网安备 33010602011771号