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