Given array where each element is max jump length, 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 maximum reachable index greedily.

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; }