Hardware interview practice
Find the start of a cycle
Return the node where a linked-list cycle begins, or None when the list has no cycle.
Reviewed example
Work through one case
Input
1 -> 2 -> 3 -> 4, with node 4.next pointing to node 2Expected output
node with value 2After the first slow/fast meeting, advancing one pointer from head and one from the meeting point finds the cycle entry.
What to cover
Requirements
- Use constant extra space.
- Do not modify the list.
- Separate cycle detection from entry discovery.
