Given an integer array, nums, sort it in ascending order and return the sorted array.
You must implement the sorting algorithm yourself; do not use any built-in sorting functions. The solution must run in
O(nlogn) time and use the minimum possible extra space.
Constraints:
nums.length
nums[i]
The problem requires sorting an array in ascending order with
Merge sort: It guarantees
Given an integer array, nums, sort it in ascending order and return the sorted array.
You must implement the sorting algorithm yourself; do not use any built-in sorting functions. The solution must run in
O(nlogn) time and use the minimum possible extra space.
Constraints:
nums.length
nums[i]
The problem requires sorting an array in ascending order with
Merge sort: It guarantees