代码:
class Solution {
public int hIndex(int[] citations) {
int n = citations.length;
int l=0,r=n-1;
while(l<=r){
int m = l + (r - l)/2;
if(n-m==citations[m])return n-m;
else if(n-m<citations[m]){
r = m-1;
}else{
l = m+1;
}
}
return n-l;
}
}