```
class Solution {
public:
bool canJump(int A[], int n) {
int max = A[0];
for(int i=1;i<=max && max<n-1;i++) {
if(A[i]+i > max) {
max = A[i]+i;
}
}
return max>n-2;
}
};
```

tried my best. but i think its not good enough.