JavaScript solution


  • 0
    K
    var canJump = function(nums) {
        var jump = 0
        var len = nums.length;
        for (var i = 0; i < len; i++){
            jump = Math.max(nums[i], jump);
            if(jump === 0 && i !== len -1 )return false;
            jump--;
        }
        return true;
    };
    
    

Log in to reply
 

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