H-Index II(二分)
Given an array of citationssorted in ascending order(each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.
According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at leasth citations each, and the other N − h papers have no more thanh citations each."
Example:
Note:
If there are several possible values for h, the maximum one is taken as the h-index.
Follow up:
This is a follow up problem to
, where
citations
is now guaranteed to be sorted in ascending order.
Could you solve it in logarithmic time complexity?
分析
用标准二分模板做。记得条件是num[m]>=n-m(长度)
H-index I完全一样,就是需要排序而已
Last updated