Mergesort Linkedlist
easy
Given the head of a linked list, return the list after sorting it in increasing order. Time Complexity : O(nlogn) Space Complexity : constant space
Constraints
0 <= N <= 10^6
Format
Input
1->7->2->6->3->5->4->null
Output
1->2->3->4->5->6->7->null
Example
Sample Input
4
0
6
7
5
Sample Output
0 5 6 7
Question Video