Easiest C++ Solution in O(n)

programming
Tags: #<Tag:0x00007f1825f96638>

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