134. Sort List
MediumLinked List
Given the head of a linked list, return the list after sorting it in ascending order.
Examples
Input: [4,2,1,3]
Output: [1,2,3,4]
Explanation: Merge sort produces the ascending order 1,2,3,4.
Constraints
- The number of nodes in the list is in the range [0, 5 * 10^4].
- -10^5 <= Node.val <= 10^5
Loading...
Run checks all cases above. Submit evaluates all test cases.