After using recursive method, it says time exceeds, then I know I should try DP.

Please take a look at the two codes below, they both use DP, and the only difference between them is just a line in the for( ; ; ) part. Why so sensitive??? Could anyone tell me why one of them is accepted but the other is rejected? Is the accepted one better than the other one generally, or just in terms of the certain test data?

```
public boolean canJump(int[] A) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if(A.length==0)
return false;
if(A.length==1)
return true;
boolean[] flag = new boolean[A.length];
flag[A.length-1] = true;
for(int i=A.length-2; i>=0; i--) {
for(int j=i+1; j<A.length&&j<=i+A[i]; j++) {
if(flag[j]==true) {
flag[i] = true;
break;
}
}
}
return flag[0];
}
public boolean canJump(int[] A) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if(A.length==0)
return false;
if(A.length==1)
return true;
boolean[] flag = new boolean[A.length];
flag[A.length-1] = true;
for(int i=A.length-2; i>=0; i--) {
for(int j=Math.min(A.length-1,i+A[i]); j>i; j--) {
if(flag[j]==true) {
flag[i] = true;
break;
}
}
}
return flag[0];
}
```