Update the callouts for the algorithm problems.

This commit is contained in:
krahets
2023-05-21 19:58:21 +08:00
parent d95c628eef
commit 24d90931e3
8 changed files with 29 additions and 37 deletions
+3 -1
View File
@@ -8,7 +8,9 @@
## 查找最左一个元素
!!! question "查找并返回元素 `target` 在有序数组 `nums` 中首次出现的索引。若数组中不包含该元素,则返回 $-1$ 。数组可能包含重复元素。"
!!! question
给定一个长度为 $n$ 的有序数组 `nums` 。请查找并返回元素 `target` 在该数组中首次出现的索引。若数组中不包含该元素,则返回 $-1$ 。数组可能包含重复元素。
实际上,我们可以仅通过二分查找解决以上问题。方法的整体框架不变,先计算中点索引 `m` ,再判断 `target``nums[m]` 大小关系: