Reorder List

Given a singly linked listL:L_0→_L_1→…→_Ln-1→L_n,
reorder it to:_L_0→_Ln
L_1→_Ln-1→L_2→_Ln-2→…

You may not modify the values in the list's nodes, only nodes itself may be changed.

Ex1.

Given 1->2->3->4, reorder it to 1->4->2->3.
Given 1->2->3->4->5, reorder it to 1->5->2->4->3.

results matching ""

    No results matching ""