Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitacf5cf9

Browse files
committed
update: 35
1 parent54c27e0 commitacf5cf9

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

Lines changed: 5 additions & 1 deletion
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
returnleft;
2529
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp