Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Sort an Array

XPChallenge Points: 20
levelLevel: Medium

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.

Example 1:

Input: nums = [9, 4, 6, 2]

Output: [2, 4, 6, 9]

Example 2:

Input: nums = [3, 3, 2, 1]

Output: [1, 2, 3, 3]

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result