class Solution {
public:
bool canJump(vector<int>& nums) {
vector<int> remain(nums.size(), 0);
remain[0] = 0;
for (int i = 1; i < nums.size(); i++) {
remain[i] = max(remain[i - 1], nums[i - 1]) - 1;
if (remain[i] < 0) {
return false;
}
}
return true;
}
};