Problem 1721 · Medium

Swapping Nodes in a Linked List

Find the k-th node from the start and the k-th node from the end with two pointers, then swap their values.

Open the interactive visualisation