Untitled
unknown
plain_text
2 years ago
286 B
5
Indexable
class Solution {
public:
int hIndex(vector<int>& cit) {
int n=cit.size();
int s=0,e=n-1;
while(s<=e){
int mid=s+(e-s)/2;
int h=n-mid;
if(cit[mid]<h) s=mid+1;
else e=mid-1;
}
return n-s;
}
};Editor is loading...
Leave a Comment