head, the first node of a singly linked list (None if the list is empty). Arrange the nodes in non-decreasing order of their values and return the first node of the resulting list.
Try to stay within O(n log n) time without copying the values into an array.head=list_node([7, -2, 7, 0]) → [-2, 0, 7, 7]
The values in non-decreasing order are -2, 0, 7, 7.
head=list_node([3]) → [3]
A one-node list is already sorted.
head=list_node([]) → None
head=list_node([7, -2, 7, 0])
[-2, 0, 7, 7]
Run checks the first 3 tests in your browser. Submit checks all 110 tests on the server, hidden ones included.