
Rearrange and return a linked list in such a way that all odd position nodes are together and all even positions node are together
You just need to return the head of new linked list, don't print the elements.
Line 1 : Linked list elements of length n (separated by space and terminated by -1)
Output format :
Updated list elements (separated by space)
1 <= n <= 10^4
1 2 3 4 5 6 7 8 -1
1 3 5 7 2 4 6 8