Share my soulation in C


  • 0
    A
    bool canJump(int* nums, int numsSize) {
        int i=1,c;
        if(numsSize==1)     return 1;
        int can =1;
        int cannot =0;
        c = cannot;
        for(int n = numsSize-2;n>=0;n--){
            if(nums[n]>=i){
                i=1;
                c=can;
            }
            else{
                c = cannot;
                i++;
            }
        }
        return c;

Log in to reply
 

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