贪心
class Solution {
public:
bool canJump(vector<int>& nums) {
int n = nums.size();
int p = 0;
int s = nums[0];
while (s && p < n) {
p++;
s--;
if (nums[p] > s) s = nums[p];
}
return p >= n - 1;
}
};