Problem statement

https://binarysearch.com/problems/Hoppable/

Solution

Equal to Leetcode 55. Jump Game

Complexity

Time and space complexity is O(n).

Code

class Solution:
    def solve(self, nums):
        t = list(accumulate([i + num for i, num in enumerate(nums)], max))
        return all(i != t[i] for i in range(len(t) - 1))