How would you solve a sorting algorithm problem within a live coding time constraint?
Implement merge_sort(nums) to return the input integers in nondecreasing order. Use a comparison-based algorithm rather than the built-in sorting function. The function should return a new list and leave nums unchanged.
Input: a list of integers. Output: a sorted list of integers.
def merge_sort(nums):