mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
Update binary_search.md
Edited number out of bound topic
This commit is contained in:
@ -328,7 +328,10 @@ $$
|
|||||||
=== "Go"
|
=== "Go"
|
||||||
|
|
||||||
```go title=""
|
```go title=""
|
||||||
|
// (i + j) 有可能超出 int 的取值范围
|
||||||
|
m := (i + j) / 2
|
||||||
|
// 更换为此写法则不会越界
|
||||||
|
m := i + (j - i) / 2
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "JavaScript"
|
=== "JavaScript"
|
||||||
|
|||||||
Reference in New Issue
Block a user