Implement sort_list(nums) to return a new list containing the same elements in ascending numerical order. The input list must not be modified. Return an empty list when the input is empty.
Constraints
0 <= len(nums) <= 10^4
-10^9 <= nums[i] <= 10^9
The input contains integers.
The input list must remain unchanged.
Function Signature
defsort_list(nums):
Interviewer
Whenever you're ready, walk me through your approach or go straight to the code. The requirements are in the Question tab.