Find Cycle Entry
After they meet, restart one at the head and walk both by one. They meet again at the entry.
Fast and Slow Pointers: Where the loop begins
Step 1: slow to 2, fast to 3.
Cost
- Best
- O(n)
- Average
- O(n)
- Worst
- O(n)
- Space
- O(1)
Before this
Leads to
Topics that need this one first.
Taught by the same lesson
Fast and Slow Pointers covers these too, in the same run.