mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-13 11:21:42 +08:00
add leetcode problem-cn part2
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<p>搜索旋转数组。给定一个排序后的数组,包含n个整数,但这个数组已被旋转过很多次了,次数不详。请编写代码找出数组中的某个元素,假设数组元素原先是按升序排列的。若有多个相同元素,返回索引值最小的一个。</p>
|
||||
|
||||
<p><strong>示例1:</strong></p>
|
||||
|
||||
<pre><strong> 输入</strong>: arr = [15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14], target = 5
|
||||
<strong> 输出</strong>: 8(元素5在该数组中的索引)
|
||||
</pre>
|
||||
|
||||
<p><strong>示例2:</strong></p>
|
||||
|
||||
<pre><strong> 输入</strong>:arr = [15, 16, 19, 20, 25, 1, 3, 4, 5, 7, 10, 14], target = 11
|
||||
<strong> 输出</strong>:-1 (没有找到)
|
||||
</pre>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ol>
|
||||
<li>arr 长度范围在[1, 1000000]之间</li>
|
||||
</ol>
|
Reference in New Issue
Block a user