Problem 24 · Medium

Swap Nodes in Pairs

Walk a chain in pairs and relink each two-node pair so the second node moves in front, leaving stored values untouched.

Open the interactive visualisation