We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19c3406 commit a37e67dCopy full SHA for a37e67d
91/binary-search.md
@@ -544,6 +544,24 @@ def bisect_left(A, x):
544
return l
545
```
546
547
+##### Java
548
+
549
+```java
550
+import java.util.*;
551
+public class BinarySearch {
552
+ public int getPos(int[] A, int val) {
553
+ int low=0,high=A.lenght-1;
554
+ while (low <= high){
555
+ int mid = (low + high)/2;
556
+ if (A[mid] >= val){
557
+ high = mid-1;
558
+ }else low = mid+1;
559
+ }
560
+ return low;
561
562
+}
563
+```
564
565
其他语言暂时空缺,欢迎
566
[PR](https://github.com/azl397985856/leetcode-cheat/issues/4)
567
0 commit comments