Floyd's cycle detection

medium

The fast pointer gains one position per step on the slow one, so they must meet. Then restarting one at the head finds the loop entry - and the algebra behind that is worth seeing once.

Worst O(n)Space O(1)
Loading the floyd's cycle detection engine…

Where to go next