Easiest solution by simply iterating array in just few lines


#1
int Solution::canJump(vector<int> &A) {
int myPower=A[0];
for(int i=1;i<A.size();i++){
    if(myPower==0)
    return 0;
    myPower--;
    myPower=max(A[i],myPower);
}
return 1;}