题目 <https://leetcode-cn.com/problems/jump-game/>
bool canJump(int* nums, int numsSize){
bool *dp = malloc(sizeof(bool) * numsSize);//表示i能否跳到结尾
dp[numsSize-1] = true;
int i,j;
for(i=numsSize-2;i>=0;i--){
for(j=i+1;j<=i+nums[i]&&j<numsSize;){
if(dp[j] == true){
break;
}else{
j += (nums[j]+1);
}
}
if(j<=i+nums[i] && j<numsSize){
dp[i] = true;
}else{
dp[i] = false;
}
}
bool flag = dp[0];
free(dp);
return flag;
}