Skip to content

Commit 4ece429

Browse files
committed
Create README - LeetHub
1 parent 73e924f commit 4ece429

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

0045-jump-game-ii/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h2><a href="https://leetcode.com/problems/jump-game-ii">45. Jump Game II</a></h2><h3>Medium</h3><hr><p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code> of length <code>n</code>. You are initially positioned at <code>nums[0]</code>.</p>
2+
3+
<p>Each element <code>nums[i]</code> represents the maximum length of a forward jump from index <code>i</code>. In other words, if you are at <code>nums[i]</code>, you can jump to any <code>nums[i + j]</code> where:</p>
4+
5+
<ul>
6+
<li><code>0 &lt;= j &lt;= nums[i]</code> and</li>
7+
<li><code>i + j &lt; n</code></li>
8+
</ul>
9+
10+
<p>Return <em>the minimum number of jumps to reach </em><code>nums[n - 1]</code>. The test cases are generated such that you can reach <code>nums[n - 1]</code>.</p>
11+
12+
<p>&nbsp;</p>
13+
<p><strong class="example">Example 1:</strong></p>
14+
15+
<pre>
16+
<strong>Input:</strong> nums = [2,3,1,1,4]
17+
<strong>Output:</strong> 2
18+
<strong>Explanation:</strong> The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.
19+
</pre>
20+
21+
<p><strong class="example">Example 2:</strong></p>
22+
23+
<pre>
24+
<strong>Input:</strong> nums = [2,3,0,1,4]
25+
<strong>Output:</strong> 2
26+
</pre>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Constraints:</strong></p>
30+
31+
<ul>
32+
<li><code>1 &lt;= nums.length &lt;= 10<sup>4</sup></code></li>
33+
<li><code>0 &lt;= nums[i] &lt;= 1000</code></li>
34+
<li>It&#39;s guaranteed that you can reach <code>nums[n - 1]</code>.</li>
35+
</ul>

0 commit comments

Comments
 (0)