Given array of jump lengths at each position, determine if you can reach the last index.

Input: nums=[2,3,1,1,4] → Output: true Input: nums=[3,2,1,0,4] → Output: false

Track the maximum reachable index. If current index exceeds it, stuck.

public boolean canJump(int[] nums) { int maxReach = 0; for (int i = 0; i < nums.length; i++) { if (i > maxReach) return false; maxReach = Math.max(maxReach, i + nums[i]); } return true; }