class Solution { public int jump(int[] nums) { int steps=0; int max=0; int cur=0; for(int i=0;i<nums.length-1;i++) { cur=Math.max(cur, i+nums[i]); if(i==max) { steps++; max=cur; } } return steps; } }
class Solution { public int jump(int[] nums) { int steps=0; int max=0; int cur=0; for(int i=0;i<nums.length-1;i++) { cur=Math.max(cur, i+nums[i]); if(i==max) { steps++; max=cur; } } return steps; } }