Jump Game LeetCode solution in Java
1class Solution {2public boolean canJump(int[] nums) {3int maxjump = 0;4for (int i = 0; i < nums.length; i++) {5// If the current index 'i' is less than current maximum jump 'curr'. It means there is no way6// to jump to current index...7// so we should return false8if (maxjump < i) return false;9else maxjump = Math.max(maxjump, nums[i] + i); // Update the current maximum jump...10}11return true;12}13}1415// nums[i]+1 gives themax jump index possible from i