Skip to content

Commit 23bad3b

Browse files
authored
Create Solution.java
1 parent fde7b1d commit 23bad3b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int hIndex(int[] citations) {
3+
int n = citations.length;
4+
int l = 0, r = n;
5+
while (l < r) {
6+
int mid = l + r + 1 >>> 1;
7+
if (citations[n - mid] >= mid) l = mid;
8+
else r = mid - 1;
9+
}
10+
return r;
11+
}
12+
}

0 commit comments

Comments
 (0)