Reach the final index
Each nonnegative value gives the maximum jump length from its index. Return whether the last index is reachable from index zero. Empty input returns False.
index, jump, farthest = 1, 3, 2
print(max(farthest, index+jump))Reason about the state
Scan only reachable positions and retain the farthest index seen. A position beyond that frontier proves no later position can be reached. Before writing code, identify what each variable means after one iteration. Walk through the example and explain why the next transition preserves that meaning. Then check the smallest permitted input and a case with repeated values. A correct answer follows the contract for every input, including the boundary cases in the checks. Keep any input mutation within the stated rules; return a fresh result when the task asks for one.
Your task
Each nonnegative value gives the maximum jump length from its index. Return whether the last index is reachable from index zero. Empty input returns False.
The explanation opens here once every check passes.