1 parent f79129a commit 6e7b332Copy full SHA for 6e7b332
1 file changed
H-Index II
@@ -0,0 +1,20 @@
1
+class Solution {
2
+public:
3
+ int hIndex(vector<int>& citations)
4
+ {
5
+ int low=0, high = citations.size()-1, mid;
6
+ int len = citations.size();
7
+ while(low<=high)
8
9
+ mid = (high+low)/2;
10
+
11
+ if(citations[mid] >= len-mid)
12
+ high = mid-1;
13
+ else
14
+ low = mid+1;
15
+ }
16
17
+ int ans = len-low;
18
+ return ans;
19
20
+};
0 commit comments