mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 07:21:40 +08:00
更新国内版力扣题目描述变更
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
<p>A magic index in an array <code>A[0...n-1]</code> is defined to be an index such that <code>A[i] = i</code>. Given a sorted array of integers, write a method to find a magic index, if one exists, in array A. If not, return -1. If there are more than one magic index, return the smallest one.</p>
|
||||
|
||||
<p><strong>Example1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong> Input</strong>: nums = [0, 2, 3, 4, 5]
|
||||
<strong> Output</strong>: 0
|
||||
</pre>
|
||||
|
||||
<p><strong>Example2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong> Input</strong>: nums = [1, 1, 1]
|
||||
<strong> Output</strong>: 1
|
||||
</pre>
|
||||
|
||||
<p><strong>Note:</strong></p>
|
||||
|
||||
<ol>
|
||||
<li><code>1 <= nums.length <= 1000000</code></li>
|
||||
<li>This problem is the follow-up of the original problem in the book, i.e. the values are not distinct.</li>
|
||||
</ol>
|
||||
<p>A magic index in an array <code>A[0...n-1]</code> is defined to be an index such that <code>A[i] = i</code>. Given a sorted array of integers, write a method to find a magic index, if one exists, in array A. If not, return -1. If there are more than one magic index, return the smallest one.</p>
|
||||
|
||||
|
||||
|
||||
<p><strong>Example1:</strong></p>
|
||||
|
||||
|
||||
|
||||
<pre>
|
||||
|
||||
<strong> Input</strong>: nums = [0, 2, 3, 4, 5]
|
||||
|
||||
<strong> Output</strong>: 0
|
||||
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
<p><strong>Example2:</strong></p>
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user