Reorder List

Given the head of a singly linked list, reorder it so the nodes appear in the pattern:

L0 -> Ln -> L1 -> Ln-1 -> L2 -> Ln-2 -> ...

The list should be rearranged by rewiring pointers, not by changing node values.

Examples
Input: [1,2,3,4]
Output: [1,4,2,3]
Hints

Reorder List

Given the head of a singly linked list, reorder it so the nodes appear in the pattern: