What's the benefit to have a messy solution?


  • 0
    3

    Storing everything in a list and apply quick sort or any other built-in sort function will only take O(NLogN) #
    ps1 N is the number of elements
    ps2 Using a bucket sort can reach O(N)

    While using merge sort or heap also need NLogN

    So, what's the point of this problem if we can not break O(N LogN)


Log in to reply
 

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