We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I don't think both are same. Sorting makes it solution complex(considering we are not using in-built sorting method). Also sorting will give nlogn complexity and finding min and max in next loop makes O(n) + O(nlogn) = O(nlogn) total complexity of this solution. Correct me if I am wrong.
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
I don't think both are same. Sorting makes it solution complex(considering we are not using in-built sorting method). Also sorting will give nlogn complexity and finding min and max in next loop makes O(n) + O(nlogn) = O(nlogn) total complexity of this solution. Correct me if I am wrong.