912. Sort an Array

Practice Sort an Array for free on NudgeCode: Medium, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return nums sorted in ascending order. The point of this problem is to write the sort yourself (merge sort, heap sort, quicksort...) in O(n log n) time. The judge only checks the output, so it cannot tell whether you called a built-in sort; that part is up to you.

Example

nums = [5,2,3,1]  ->  [1,2,3,5]

Constraints