Given a list L₀ → L₁ → … → Lₙ, reorder it in place to L₀ → Lₙ → L₁ → Lₙ₋₁ → L₂ → … and return the head. Only nodes may be rearranged, not values (though the judge only checks the resulting order).
Input: one line of space-separated integers. Output: the reordered list's values.
1 2 3 4
1 4 2 3
1 2 3 4 5
1 5 2 4 3
Run your code against the sample tests, or Submit to run the full suite.