← Problem library

Sorting · Python

Merge Sort

MediumSortingUnsolved

Problem

Return a new sorted list using merge sort; do not call sorted() or list.sort().

Example input

nums = [4, 1, 3, 2]

Example output

[1, 2, 3, 4]

Constraints

0 <= len(nums) <= 10,000

Python workspace

Reset code

Execution uses a timed child process in a temporary directory. It is development-only isolation, not a production sandbox.