Given an array nums
where each element represents the maximum jump length at that position, determine if you can reach the last index starting from index 0.
Rules:
Constraints:
Examples:
// Example 1:
console.log(canJump([1, 2, 0, 1, 0]));
// Output: true
// Explanation: Jump path: 0->1->3->4
// Example 2:
console.log(canJump([1, 2, 1, 0, 1]));
// Output: false
// Explanation: Can't reach last index