This commit is contained in:
krahets
2023-09-02 23:03:42 +08:00
parent 799698e67c
commit 503ca797b8
12 changed files with 314 additions and 91 deletions
+4 -1
View File
@@ -141,7 +141,10 @@ status: new
```typescript title="binary_search_insertion.ts"
/* 二分查找插入点(无重复元素) */
function binarySearchInsertionSimple(nums: Array<number>, target: number): number {
function binarySearchInsertionSimple(
nums: Array<number>,
target: number
): number {
let i = 0,
j = nums.length - 1; // 初始化双闭区间 [0, n-1]
while (i <= j) {