スポンサーリンク

【LeetCode】55. Jump Game 解答・解説【Python】

スポンサーリンク
スポンサーリンク
この記事は約2分で読めます。

 

問題

原文

You are given an integer array nums. You are initially positioned at the array’s first index, and each element in the array represents your maximum jump length at that position.

Return true if you can reach the last index, or false otherwise.

 

Example 1:

Example 2:

 

Constraints:

  • 1 <= nums.length <= 104
  • 0 <= nums[i] <= 105

 

内容

あなたには整数の配列 nums が与えられます。あなたは最初、配列の最初のインデックスに位置し、配列の各要素は、その位置でのあなたの最大ジャンプ長を表します。

最後のインデックスに到達できればtrueを、そうでなければfalseを返します。

 

※正しくない可能性があります。

 

解答

解答1:Python

 

 

 

 

解答2:

 

 

 

メモ・参考・感想

 

 

 

前:17. Letter Combinations of a Phone Number

次:45. Jump Game II

LeetCode 解答・解説記事一覧

コメント