1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/搜索旋转数组 [search-rotate-array-lcci].html
2022-03-29 12:43:11 +08:00

20 lines
776 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>