My java solution


  • 0
    W

    public class Solution {
    public boolean canJump(int[] nums) {
    if(nums==null||nums.length<=1)
    return true;
    int can = nums.length-1;
    for(int i=nums.length-2;i>=0;i--){
    if(nums[i]>=can-i)
    can= i;
    }
    if(can==0)
    return true;
    else
    return false;
    }
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.