1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 11:21:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

add leetcode problem-cn part2

This commit is contained in:
2022-03-27 20:38:29 +08:00
parent 5a4fa6db12
commit 0fc7f4b734
1617 changed files with 134637 additions and 0 deletions

View File

@@ -0,0 +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&nbsp;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 &lt;= nums.length &lt;= 1000000</code></li>
<li>This problem is the&nbsp;follow-up of the original problem in the book, i.e.&nbsp;the values are&nbsp;not distinct.</li>
</ol>