You are given an integer array nums. Your goal is to return the array sorted in ascending order.
You cannot use built-in sorting methods.
You must achieve a time complexity of O(n log n) and keep memory usage as low as possible.
Input: nums = [9, 4, 6, 2]
Output: [2, 4, 6, 9]
Input: nums = [3, 3, 2, 1]
Output: [1, 2, 3, 3]
Accepted:
Submission: