55. Jump Game
题目链接:https://leetcode.com/problems/jump-game/
解题思路:
https://www.cnblogs.com/271934Liao/p/7053406.html
1 class Solution { 2 public boolean canJump(int[] nums) { 3 4 int max=0; 5 for(int i=0;i<nums.length-1;i++) 6 { 7 max= Math.max(max,i+nums[i]); 8 if(max<i+1) 9 { 10 return false;//如果到达不了后续点(这里通常情况为 当前点为0,前面的能达到的最大点 为当前点或者当前点前面的点),返回false 11 } 12 } 13 14 if(max>=nums.length-1) 15 { 16 return true; 17 } 18 return true; 19 20 } 21 }