当前位置: 代码迷 >> 综合 >> 55. Jump Game
  详细解决方案

55. Jump Game

热度:68   发布时间:2024-02-02 01:39:03.0
public boolean canJump(int[] nums) {if (nums == null || nums.length < 2) return true;int n = nums.length;int last = n-1;for (int i = n-2; i >= 0; i--) {if (nums[i] + i >= last) {last = i;}}return last == 0;}
  相关解决方案