Skip to content

Commit acf5cf9

Browse files
committed
update: 35
1 parent 54c27e0 commit acf5cf9

File tree

1 file changed

+5
-1
lines changed
  • src/search-insert-position

1 file changed

+5
-1
lines changed

src/search-insert-position/res.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/**
2+
* 二分法细节处理
3+
* 1. mid 防止过大数的取值 mid = left + (right - left) / 2;
4+
* 2. 循环条件 while (left <= right)
5+
*
26
* @param {number[]} nums
37
* @param {number} target
48
* @return {number}
@@ -20,6 +24,6 @@ var searchInsert = function(nums, target) {
2024
left = mid + 1;
2125
}
2226
}
23-
27+
2428
return left;
2529
};

0 commit comments

Comments
 (0)