class Solution { public boolean canJump(int[] nums) { int jumpMax =0; for(int i = 0; i<nums.length; i++){ if (i>jumpMax) return false; jumpMax = i+nums[i]>jumpMax? i+nums[i]: jumpMax; } return true; } }
Last updated 3 years ago
Was this helpful?