time complexity of the classic solution


  • 0
    H

    Hi there :)
    is there any discussion on the time complexity of this classic solution?

            for(int i=2; i*i<n; i++){ // pruning
                if(!nums[i]) continue; // good pruning
                for(int j=2; i*j<n; j++){
                    nums[i*j] = false;
                }
            }
    

Log in to reply
 

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