Easy C++ Soln in few lines


#1

int Solution::canJump(vector &A) {
int n=A.size();
int temp=n-1;
for(int i=n-1;i>=0;i–){
if(A[i]>=temp-i){
temp=i;
}
}
if(temp==0){
return 1;
}
return 0;
}