Two pointers advancing at different speeds can detect a cycle using constant auxiliary storage. Detection and locating entry are separate steps.
Before you start
You should know arrays, loops and basic complexity notation. Start with a small input you can trace by hand. State what each variable means and which invariant is maintained, then use that invariant to explain correctness before discussing performance or writing a more compact solution.
The practical goal is to reason through this situation: In a cycle, the faster pointer eventually meets the slower pointer. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Check termination safely
Fast and fast.next must exist before advancing twice.
Step 2: Detect a meeting
Different speeds eventually meet inside a reachable cycle.
Step 3: Locate the entry separately
Reset one pointer to head and advance both one step after a meeting.
Worked scenario
In a cycle, the faster pointer eventually meets the slower pointer.
A list has a noncyclic prefix leading into a loop. Detecting the loop does not identify its entry from the meeting position alone. The second phase uses the distance relationship established by the meeting; in an acyclic list fast reaches the end and that phase must not run.
Common mistake
Dereferencing fast.next without checking termination breaks acyclic input.
Verify the behavior
Test empty, one-node acyclic, self-loop and a cycle beginning after a prefix.
Interview exercise
Find the cycle entry.
Answer and reasoning
After a meeting, reset one pointer to the head and advance both one step until they meet at the entry.
Continue learning
Compare the scenario with the Data Structures and Algorithms interview questions and test your understanding with the Data Structures and Algorithms MCQs. For terminology and implementation details, consult the reference material.