Jump Game II LeetCode solution in Java
1class Solution {23public int jump(int[] nums) {45int result = 0;67int L = 0;8int R = 0;910while (R < nums.length - 1) {1112int localMaxRight = 0;1314for (int i = L; i <= R; i++) {1516localMaxRight = Math.max(i + nums[i], localMaxRight);17}1819L = R + 1;20R = localMaxRight;21result++;22}2324return result;25}26}