Download Jump Game.py
class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ # greedy # https://leetcode.com/articles/jump-game/ length = len(nums) begin = length - 1 for i in reversed(range(length - 1)): if i + nums[i] >= begin: begin = i return not begin
Leetcode 055 Jump Game problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.