Tap here to switch tabs
Problem
Submissions

Problem: Sort an Array

Sort an Array asks you to sort and return a given integer array in ascending order, including negative values, without built-in sorting, in the required time, and with minimum 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 ≤103\leq 10^3

  • −103≤-10^3 \leq nums[i] ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort an Array

Sort an Array asks you to sort and return a given integer array in ascending order, including negative values, without built-in sorting, in the required time, and with minimum 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 ≤103\leq 10^3

  • −103≤-10^3 \leq nums[i] ≤103\leq 10^3