Time problem


  • 0
    E

    I'm not sure why this is so time complex. Can someone explain that to me.

        int index = nums.size()-1, jumps = 0;
        
        while(index != 0){
            for(int i = 0; i < nums.size(); i++)
                if(i+nums[i] >= index){
                    index = i;
                    break;
                }
            jumps++;
        }
        return jumps;
        }```

Log in to reply
 

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