We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9083ce3 commit 00696feCopy full SHA for 00696fe
Solutions/0033. 搜索旋转排序数组.md
@@ -65,7 +65,7 @@
65
66
然后创建两个指针 $left$、$right$,分别指向数组首尾。让后计算出两个指针中间值 $mid$。将 $mid$ 与两个指针做比较,并考虑与 $target$ 的关系。
67
68
-- 如果 $mid[mid] == target$,说明找到了 $target$,直接返回下标。
+- 如果 $nums[mid] == target$,说明找到了 $target$,直接返回下标。
69
- 如果 $nums[mid] \ge nums[left]$,则 $mid$ 在左半部分(因为右半部分值都比 $nums[left]$ 小)。
70
- 如果 $nums[mid] \ge target$,并且 $target \ge nums[left]$,则 $target$ 在左半部分,并且在 $mid$ 左侧,此时应将 $right$ 左移到 $mid - 1$ 位置。
71
- 否则如果 $nums[mid] \le target$,则 $target$ 在左半部分,并且在 $mid$ 右侧,此时应将 $left$ 右移到 $mid + 1$ 位置。
0 commit comments