mirror of
https://github.com/chefyuan/algorithm-base.git
synced 2024-12-27 21:06:17 +00:00
代码重构 【Github Actions】
This commit is contained in:
parent
94d9b4c70f
commit
d0abf3e1d8
@ -140,7 +140,6 @@ func binarySearch(nums []int, target, left, right int) int {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
二分查找的思路及代码已经理解了,那么我们来看一下实现时容易出错的地方
|
二分查找的思路及代码已经理解了,那么我们来看一下实现时容易出错的地方
|
||||||
|
|
||||||
1.计算 mid 时 ,不能使用 (left + right )/ 2,否则有可能会导致溢出
|
1.计算 mid 时 ,不能使用 (left + right )/ 2,否则有可能会导致溢出
|
||||||
|
@ -87,6 +87,7 @@ class Solution {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Go Code:
|
Go Code:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func searchMatrix(matrix [][]int, target int) bool {
|
func searchMatrix(matrix [][]int, target int) bool {
|
||||||
if len(matrix) == 0 {
|
if len(matrix) == 0 {
|
||||||
|
@ -62,6 +62,7 @@ public static int lowBoundnum(int[] nums,int target,int left, int right) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Go Code:
|
Go Code:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func lowBoundnum(nums []int, target, left, right int) int {
|
func lowBoundnum(nums []int, target, left, right int) int {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user