C 0MS with explantion online


  • 4
    Y
    bool canJump(int* nums, int numsSize) {
    int i,j,pos=numsSize-1;
    for(j=numsSize-2;j>-1;j--){
        if(nums[j]>=pos-j){
            pos = j;
        }
    }
    if(pos==0)
        return true;
    else
        return false;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.