This commit is contained in:
krahets
2023-05-22 22:01:26 +08:00
parent f31f630655
commit 9a0252f484
19 changed files with 137 additions and 135 deletions
@@ -1889,7 +1889,7 @@
<h1 id="102">10.2. &nbsp; 二分查找边界<a class="headerlink" href="#102" title="Permanent link">&para;</a></h1>
<p>上一节规定目标元素在数组中是唯一的。如果目标元素在数组中多次出现,上节介绍的方法只能保证返回其中一个目标元素的索引,<strong>而无法确定该索引的左边和右边还有多少目标元素</strong></p>
<p>上一节中,题目规定数组中所有元素都是唯一的。如果目标元素在数组中多次出现,上节介绍的方法只能保证返回其中一个目标元素的索引,<strong>而无法确定该索引的左边和右边还有多少目标元素</strong></p>
<div class="admonition question">
<p class="admonition-title">Question</p>
<p>给定一个长度为 <span class="arithmatex">\(n\)</span> 的有序数组 <code>nums</code> ,数组可能包含重复元素。请查找并返回元素 <code>target</code> 在数组中首次出现的索引。若数组中不包含该元素,则返回 <span class="arithmatex">\(-1\)</span></p>