My 7 line Python solution


  • 1
    J
    class Solution(object):
    def canJump(self, nums):
        maxEdge = 0
        for i in range(len(nums)):
            if maxEdge < i:
                return False
            maxEdge = max(maxEdge, i+nums[i])
        return True

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.