mirror of
https://github.com/krahets/hello-algo.git
synced 2026-06-14 22:26:38 +08:00
build
This commit is contained in:
@@ -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` 的元素。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user