```
int hIndex(vector<int>& citations) {
int size = citations.size();
int left = 0, right = size;
while(left < right){
int mid = left + (right - left) / 2;
// mid + 1 is a valid one , set left = mid + 1
// It is very like lower/upper bound
// the difference is "is => may be"
if(citations[size - mid - 1] > mid){
left = mid + 1;
}else{
right = mid;
}
}
return left;
}
```