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

fix(Update README.md):numbers[mid] == numbers[r] 并不能断定 numbers[mid] 一定不是最小值 #3730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
yanglbme merged 1 commit into doocs:main from lingxier:patch-1
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update README.md
numbers[mid] == numbers[r] 并不能断定 numbers[mid] 一定不是最小值。应该修改为:
无法确定最小值的位置,但可以简单地缩小搜索范围,
  • Loading branch information
lingxier authored Nov 7, 2024
commit 65b3a21c7c6cc71346c986d7cf2ce59368a90d16
2 changes: 1 addition & 1 deletion lcof/面试题11. 旋转数组的最小数字/README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/lcof/%E9%9D%A2%E8%AF%95%E9

- `numbers[mid] > numbers[r]`:中间元素一定不是最小值,因此 $l = mid + 1$;
- `numbers[mid] < numbers[r]`:中间元素可能是最小值,因此 $r = mid$;
- `numbers[mid] == numbers[r]`:中间元素一定不是最小值,因此 $r = r - 1$。
- `numbers[mid] == numbers[r]`:无法确定最小值的位置,但可以简单地缩小搜索范围,因此 $r = r - 1$。

循环结束时,指针 $l$ 和 $r$ 指向同一个元素,即为最小值。

Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /