mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-14 20:50:58 +00:00
Update the callouts for the algorithm problems.
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
|
||||
## 查找最左一个元素
|
||||
|
||||
!!! question "查找并返回元素 `target` 在有序数组 `nums` 中首次出现的索引。若数组中不包含该元素,则返回 $-1$ 。数组可能包含重复元素。"
|
||||
!!! question
|
||||
|
||||
给定一个长度为 $n$ 的有序数组 `nums` 。请查找并返回元素 `target` 在该数组中首次出现的索引。若数组中不包含该元素,则返回 $-1$ 。数组可能包含重复元素。
|
||||
|
||||
实际上,我们可以仅通过二分查找解决以上问题。方法的整体框架不变,先计算中点索引 `m` ,再判断 `target` 和 `nums[m]` 大小关系:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user