Unfold Of Linkedlist
easy
Given a singly linkedlist : l0 -> ln -> l1 -> ln-1 -> l2 -> ln-2 -> l3 -> ln-3 -> ..... reorder it : l0 -> l1 -> l2 -> l3 -> l4 -> l5 -> l6 ..... -> ln-1 -> ln for more information watch video.
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
9 5 1 1 4 4 6 6 9 9
Sample Output
5 1 4 6 9 9 6 4 1
Question Video