AlgoScope

Find Cycle Entry

After they meet, restart one at the head and walk both by one. They meet again at the entry.

Linked list algorithms, algorithm, intermediate
Slow is at 2 and fast at 3.1234567headslowfast
Slow is at 2 and fast at 3.1234567headslowfast

Fast and Slow Pointers: Where the loop begins

Decision, step 2 of 10

Step 1: slow to 2, fast to 3.

How fast and slow pointers works

Cost

Best
O(n)
Average
O(n)
Worst
O(n)
Space
O(1)

Leads to

Topics that need this one first.

Taught by the same lesson

Fast and Slow Pointers covers these too, in the same run.