This commit is contained in:
krahets
2023-08-20 13:37:08 +08:00
parent 2e27ad1680
commit 44a8568356
32 changed files with 140 additions and 130 deletions

View File

@@ -156,7 +156,7 @@ status: new
下面我们介绍两种更加取巧的方法。
### 复用查找左边界
### 1.   复用查找左边界
实际上,我们可以利用查找最左元素的函数来查找最右元素,具体方法为:**将查找最右一个 `target` 转化为查找最左一个 `target + 1`**。
@@ -310,7 +310,7 @@ status: new
[class]{}-[func]{binary_search_right_edge}
```
### 转化为查找元素
### 2.   转化为查找元素
我们知道,当数组不包含 `target` 时,最后 $i$ , $j$ 会分别指向首个大于、小于 `target` 的元素。