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
Coding & Algorithms
Software Engineer
Microsoft
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

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
linked lists
Floyd cycle detection
two pointers
file systems
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample Answer
Requirements
  • Input: head of a singly linked chain (each node is a cluster with a next pointer).
  • 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...


Submit Your Answer
Markdown supported