Leecode:Jump Game(JS解答) 思路:设置max为当前能到达的最远节点,当max < i 时,则无法到达最后一个节点,下面为示意图: function canJump(nums: number[]): boolean { let max = 0; for(let i = 0; i < nums.length; i++){ if(max < i) return false; max = Math.max(max,nums[i] + i); } return true; };