Much simpler and easier approach based on minimum index


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