题目链接:https://leetcode-cn.com/problems/jump-game/solution/tiao-yue-you-xi-by-lian-zhou/
class Solution {
public boolean canJump(int[] nums) {
if(nums.length <= 1){
return true;
}
boolean tmp;
for(int i = 0; i< nums.length; i++){
if(nums[i] == 0 && i != nums.length-1){
tmp = false;
if(i == 0){
return false;
}
for(int j = 0; j<i; j++){
if((nums[j] - nums[i]) > (i - j)){
tmp = true;
break;
}
}
if(!tmp) {
return false;
}
}
}
return true;
}
}