Is there a big difference between 64 ms and 16 ms?


  • 0
    U

    Since it began to show the chart of Accepted Solutions Runtime Distribution, I am curious about that is there a big difference between 64 ms and 16 ms? As I changed S.size() to a variable, like not calling the function every time.

    I think they are same, but in the chart, it seems that one is much better than another.


  • 5
    S

    Usually, there is no big difference for 64ms and 16ms. However, it makes sense that some slight optimization will affect the runtime, just like what you have done.

    What I would take serious from the distribution graph is when a problem I solve with O(N^2) time complexity, which takes 300+ms. However, the graph tells me there are many solutions are 60ms. I will figure out if there is a O(N log N) or O(N) solution.


  • 0
    U

    thank you very much! Very helpful!!


Log in to reply
 

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