Locate Where a Corrupted FAT Cluster Chain Loops Back
Last updated: November 29, 2026
Quick Overview
A FAT style file system stores each file as a linked chain of clusters, and a corrupted table can make the chain loop. Given the head cluster, return the cluster where the loop begins, or None if the chain terminates normally, using O(1) extra memory.
Microsoft
November 29, 20260
0
0 solved
A FAT style file system stores each file as a linked chain of clusters, and a corrupted table can make the chain loop. Given the head cluster, return the cluster where the loop begins, or None if the chain terminates normally, using O(1) extra memory.
Microsoft interviewers like grounding cycle detection in the FAT file system that Windows still supports for removable media. They want Floyd's algorithm plus the proof of why resetting one pointer to the head finds the loop entry.
What the Interviewer Expects
- Detect a loop with slow and fast pointers
- Find the loop entry by restarting one pointer from the head
- Explain the distance argument behind the second phase
- Use O(1) memory, not a visited set
- Handle a self loop and an acyclic chain
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you compute the loop length?
- How would chkdsk repair the chain once the entry is known?
- What if many files share clusters (cross-linked files)?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Input: head of a singly linked chain (each node is a cluster with a
nextpointer). - Output: the node where the cycle starts, or None.
- No modification of the chain and O(1) extra memory....
High-Level Design
Phase one: move slow by one and fast by two. If fast reaches the end, the chain terminates. Otherwise they must meet inside the loop, because the gap closes by one each step.
Phase two: let a b...