The temple dancers of Codetikki move in alternating low-high-low-high rhythm. Given a linked list, rearrange the node values so they appear in alternating low -> high -> low -> high -> ... form. Input: first line n, second line n space-separated values. Output: the rearranged list as space-separated values.
Example 1:
Example 2:
Constraints:
1 <= n <= 10^4 -10^9 <= node value <= 10^9
Tags:
