Back to course home
0% completed
Vote For New Content
Dumb question. But why wouldn’t I just sort the output array after inserting all...
Kaven Tan
Dec 21, 2022
Dumb question. But why wouldn’t I just sort the output array after inserting all the values. Less there’s some restrictions. Then if there are it should be mentioned.
0
0
Comments
Comments
Design Gurus3 years ago
There is no restriction, but because of sorting, your algorithm will take O(NlogN), which is slower than the given solution (which is O(N)).
On this page
Problem Statement
Try it yourself