Jump Game - Leetcode
O(n) Solution

You don't need to keep track of all the places you can reach.  You only need to know what is the highest index you can reach, because you can reach any lower index by choosing a shorter jump.  Scan the list from 0 to the end keeping track of the maximum reachable index.  If you ever reach an index greater than the maximum reachable index, you've hit a block and can't reach the end.

For example, for a jump list = [3,2,1,0,4].  Starting at index 0, we can reach any index up to 0 + 3 = 3.  From index 1 we can reach 1 + 2 = 3.  From 2, we can reach 2+1 = 3.  From index 3, we can reach 3 + 0 = 3.  So far the maximum reachable index is 3.  So when we reach index 4, 4 > 3 so index 4 is unreachable and we can't get to the end.

def canjump(nums):
    maximum_reachable_index = 0

    for index, max_jump in enumerate(nums):
        #print(f"{index}", end=' ')
        if index &gt; maximum_reachable_index:
            #print(f"&gt; {maximum_reachable_index} and is unreachable.")
            return False

        #print(f"+ {max_jump} =&gt; {index + max_jump} : {maximum_reachable_index} ")
        maximum_reachable_index = max(index + max_jump, maximum_reachable_index)

    return True


Uncomment the print statements to see how it works.