Given the head of a linked list, return the list after sorting it in ascending order.
Example 1
Input: head = [4,2,1,3]
Output: [1,2,3,4]
Explanation: Sorting the values 4, 2, 1, 3 in ascending order gives 1, 2, 3, 4.
Example 2
Input: head = [-1,5,3,4,0]
Output: [-1,0,3,4,5]
Explanation: Sorting -1, 5, 3, 4, 0 in ascending order gives -1, 0, 3, 4, 5.
Example 3
Input: head = [1]
Output: [1]
Explanation: A single node is already sorted.
Split the list in half with a slow/fast pointer, recursively sort each half, then merge the two sorted halves. Merge sort is ideal for linked lists because splitting and merging only relink pointers — no random access or extra array is needed.
Run checks all cases above. Submit evaluates all test cases.