You are viewing a single comment's thread. Return to all comments →
Sorting even on the most efficient algorythms is O(N log N).
You can do this without sorting - just find the total sum, min and max value. This way you get O(N) which is far better complexity.
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
Sorting even on the most efficient algorythms is O(N log N).
You can do this without sorting - just find the total sum, min and max value. This way you get O(N) which is far better complexity.