Leetcode - 55. Jump Game
55. Jump Game[M]
https://leetcode.com/problems/jump-game/
Description
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
Example 1:
1 | Input: nums = [2,3,1,1,4] |
Example 2:
1 | Input: nums = [3,2,1,0,4] |
Constraints:
1 <= nums.length <= 3 * 10^40 <= nums[i][j] <= 10^5
Solution
https://leetcode.com/problems/jump-game/solution/
https://leetcode.com/articles/jump-game/
1 | class Solution: |
45. Jump Game II[H]
https://leetcode.com/problems/jump-game-ii/
Description
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of jumps.
Example:
1 | Input: [2,3,1,1,4] |
Solution
1 | class Solution: |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment





