- Linked List Cycle (LeetCode 141): Interview Notes
- Problem
- Return true if a linked list has a cycle.
- Approach
- Floyd: slow moves one, fast moves two. If they meet there is a cycle. Hashing visited nodes also works.
- Complexity
- Time O(n), space O(1) for Floyd.
- Practice tip
- Ask follow-ups (cycle entrance, length) with an AI interview copilot: https://www.linkjob.ai/interview-copilot/.
- *Disclosure: I work on Linkjob AI.*
