Swap every two adjacent nodes of the list and return the new head. Swap the nodes themselves, not just their values.
Input: one line of space-separated integers — the list values (may be empty). Output: the resulting list's values, space-separated.
1 2 3 4
2 1 4 3
1
1
1 2 3
2 1 3
Run your code against the sample tests, or Submit to run the full suite.