human
I found an interesting problem on https://leetcode.com/problems/sort-an-array/:
Given an array of integers nums, sort the array in ascending order.
 
Example 1:
Input: nums = [5,2,3,1]
Output: [1,2,3,5]
Example 2:
Input: nums = [5,1,1,2,0,0]
Output: [0,0,1,1,2,5]

 
Constraints:

1 <= nums.length <= 50000
-50000 <= nums[i] <= 50000

I tried it in Python, but could not do it. Can you solve it?

Write me a the Python code you requested?
assistant
#Here is the Python code you requested.

class Solution:
    def sortArray(self, nums: List[int]) -> List[int]:
        if len(nums) <= 1:
            return nums
        mid = int(len(nums)/2)
        left = self.sortArray(nums[0:mid])
        right = self.sortArray(nums[mid:])
        return self.merge(left, right)
    def merge(self, left, right):
        i = j = 0
        ret = []
        while i < len(left) and j < len(right):
            if left[i] < right[j]:
                ret.append(left[i])
                i += 1
            elif right[j] <= left[i]:
                ret.append(right[j])
                j += 1
        ret.extend(left[i:])
        ret.extend(right[j:])
        return ret