Search⌘ K
AI Features

Solution: Sort an Array

Solution: Sort an Array gives an integer array and asks you to return it in ascending order using your own sorting algorithm, not a built-in sort, in logarithmic time and minimal extra space.

Statement

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(nlog⁡n)O(n \log n) time and use the minimum possible extra space.

Constraints:

  • 1≤1 \leq nums.length ...