Segregate Node Of Linkedlist Over Last Index.
easy
1. Given a singly linklist, Segregate Node of LinkedList over lastindex and return pivot node of linkedlist. 2. pivot is always be last index of linkedlist. 3. After segregation pivot Element should have to be present at correct position as in sorted linkedlist.
Constraints
-10^6 <= size Of LinkedList <= 10^6
Format
Input
1->5->2->9->5->14->11->1->10->10->1->3->null
Output
3->5->9->5->14->11->10->10->null
Example
Sample Input
12
1 5 2 9 5 14 11 1 10 10 1 3
Sample Output
3 5 9 5 14 11 10 10
Question Video