Tap here to switch tabs
Problem
Ask
Submissions

Problem: Sort an Array

med
30 min
Understand how to implement an efficient sorting algorithm that sorts integer arrays in ascending order without using built-in functions. Learn to meet the time complexity of O(n log n) and optimize space usage by crafting your own solution.

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

Constraints:

  • 11 \leq nums.length 103\leq 10^3

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

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Sort an Array

med
30 min
Understand how to implement an efficient sorting algorithm that sorts integer arrays in ascending order without using built-in functions. Learn to meet the time complexity of O(n log n) and optimize space usage by crafting your own solution.

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

Constraints:

  • 11 \leq nums.length 103\leq 10^3

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