Sort [4,2,1,3]
Input
[4, 2, 1, 3]
Output
[1, 2, 3, 4]
The list is sorted in ascending order.
Full lesson preview
Sort a singly linked list with merge sort. Input is a Python list of node values.
Problem statement
Task
Examples
Input
[4, 2, 1, 3]
Output
[1, 2, 3, 4]
The list is sorted in ascending order.
Input format
Output format
Constraints
Samples
Input
[-1, 5, 3, 4, 0]
Output
[-1, 0, 3, 4, 5]
Sorted ascending.