题目 法1:贪心 class Solution {public boolean canJump(int[] nums) {int maxIndex = nums.length - 1;int curMaxIndex = 0;for (int i = 0; i < nums.length; ++i) {if (i <= curMaxIndex) {curMaxIndex = Math.max(i + nums[i], curMaxIndex);if (curMaxIndex >= maxIndex) {return true;}}}return false;} }