You're given an array of non-negative integers. You start standing on the first index. The number at each index is the maximum jump length you can take from there — from index i you may step forward anywhere from 1 to nums[i] indices (a 0 means you can't move at all). Picture a row of stepping stones across a river, where each stone is marked with how far you're allowed to leap from it. Return true if there's some sequence of jumps that lands you on (or past) the last index, and false if you'd always get stranded. This is the classic Jump Game problem.
// nums: non-negative integers; nums[i] is the MAX jump length from index i
// returns: true if the last index is reachable from index 0, else false
function arrayReachableEnd(nums: number[]): boolean;
arrayReachableEnd([2, 3, 1, 1, 4]);
// → true
// From index 0 jump 1 to index 1 (value 3), then jump 3 to index 4. Reached.
arrayReachableEnd([3, 2, 1, 0, 4]);
// → false
// Every route lands on index 3, whose value is 0. You're stuck before the end.
nums[i] is a maximum, not an exact distance. From a stone marked 3 you may jump 1, 2, or 3 forward — whatever helps.true. You're already standing on the last index.0 is only fatal if you have no way to jump over or past it from an earlier stone.