My code is not working for a specific test case, any sort of help would be appreciated


#1

int Solution::canJump(vector &A) {
int n=A.size();
if(n==1) return 1;
bool dp[n][n];
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(i==j) dp[i][j]=1;
else{
dp[i][j]=(A[i]+i>=j);
}
}
}
for(int i=1;i<n-1;i++){
if(dp[0][n-i-1]*dp[n-i-1][n-1]) return 1;
}
return 0;
}
913 16 0 0 0 12 1 13 1 30 0 14 0 0 3 0 0 2 0 0 0 7 0 0 0 0 16 0 14 0 22 0 0 0 5 0 0 0 0 7 0 26 0 0 13 22 0 0 0 0 22 0 0 0 16 0 0 29 0 0 0 3 0 0 0 28 0 0 0 29 0 0 0 0 0 0 3 0 0 0 0 22 0 0 0 0 0 3 0 0 0 19 0 0 15 0 0 30 0 0 0 0 0 0 12 0 19 6 30 0 0 0 0 0 0 0 0 0 17 12 0 24 16 21 0 8 0 14 6 0 0 5 23 0 22 0 15 15 0 26 0 14 0 0 3 0 0 0 0 0 0 0 0 0 0 16 13 0 24 0 0 16 24 0 9 0 0 0 0 0 21 0 0 25 0 0 0 0 0 27 0 0 0 0 0 0 0 24 0 0 0 0 0 30 10 0 18 30 0 0 0 0 0 0 19 0 0 0 0 29 0 0 0 8 7 29 16 30 0 0 3 0 0 0 17 0 0 22 0 0 0 0 0 18 0 0 11 11 0 0 0 0 11 19 2 0 0 0 2 0 16 11 21 0 10 0 29 0 0 0 0 0 1 15 0 0 0 0 0 0 12 0 0 0 0 0 29 0 9 0 6 0 0 0 8 0 0 0 0 0 0 0 0 22 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 11 0 0 21 0 0 0 0 4 0 0 0 0 14 21 0 0 0 0 0 0 0 5 0 0 0 0 21 0 0 0 0 0 0 0 0 21 0 0 14 0 0 0 0 29 24 0 4 0 0 0 0 0 5 0 0 0 0 0 0 30 0 0 0 0 0 0 0 25 0 9 0 0 0 0 24 21 12 0 0 0 3 0 0 0 0 0 0 0 29 2 0 0 0 22 9 0 0 0 5 0 0 0 0 0 0 0 8 29 19 0 0 0 14 24 0 22 0 24 0 0 5 0 0 0 28 0 0 29 0 0 27 13 0 18 0 0 0 0 11 11 0 0 28 0 0 0 0 0 0 0 0 15 0 0 0 0 0 12 0 0 12 19 23 0 20 0 8 6 23 17 14 0 0 24 3 0 0 0 6 11 24 0 0 0 0 0 0 18 0 0 1 27 0 1 0 0 0 0 0 19 0 0 0 0 11 16 0 0 24 25 0 0 17 0 0 0 0 21 0 0 0 0 0 9 19 0 0 0 0 0 0 6 0 0 5 0 15 17 14 1 27 0 0 24 16 28 0 18 0 20 20 0 29 0 2 29 0 0 17 0 30 0 0 0 0 0 29 15 0 0 0 0 0 0 0 14 0 0 16 0 0 0 0 0 0 18 20 0 0 0 0 0 0 0 9 0 0 21 0 6 0 0 0 0 0 0 0 0 28 11 19 0 0 25 0 0 20 0 0 0 0 0 15 0 0 6 3 4 0 0 0 0 22 0 2 0 0 0 14 0 0 5 0 18 27 0 0 0 0 0 28 0 0 0 9 0 20 4 28 0 0 4 0 0 3 0 3 9 3 0 6 0 0 0 0 0 0 13 0 23 0 0 16 5 0 27 4 0 28 0 0 0 0 0 0 0 5 0 24 0 0 0 0 5 0 0 0 0 0 4 10 28 0 0 0 22 14 8 0 0 0 0 0 0 0 0 0 0 0 19 0 21 0 30 0 0 19 0 0 0 0 7 0 22 0 0 0 0 0 0 14 0 0 0 0 0 13 29 18 0 0 0 0 0 0 0 0 29 30 0 0 0 28 0 0 18 26 0 0 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 27 0 0 0 0 0 0 19 0 0 0 29 16 13 0 3 0 0 11 12 7 3 0 2 0 0 16 0 0 26 0 15 0 20 0 0 0 0 0 0 0 4 0 0 25 3 27 0 0 0 13 0 0 0 0 22 25 0 22 25 0 17 29 1 0 0 0 0 0 0 0 0 0 0 9 28 8 1 0 0 0 0 0 29 15 16 0 0 0 0 0 0 23 28 0 0 0 2 0 12 27 0 22 0 0