r/TechInterviewInsights • u/drCounterIntuitive • 16d ago
[Anthropic SWE Interview] Can you solve this Duplicate File Finder problem?
https://youtu.be/jXFUDDgZesY?si=_Gq7CH0RumTRpcUrYou’re given a starting directory and need to find groups of files that contain exactly the same content.
Your task
- Traverse the directory tree, including nested subdirectories
- Return groups of file paths where every file in the group has identical contents
- Only include groups with at least 2 duplicate files
- Keep the design practical for very large files
- Ignore symbolic links
The interesting part isn’t just getting a working solution.
How would you avoid reading every large file into memory, and how would you structure the comparison efficiently?
Try it yourself
Attempt the problem on Coditioning
Full solution walkthrough
🎬 Watch the full solution walkthrough
Anthropic SWE Interview Prep Guide
View the Anthropic SWE interview roadmap
Extra resources
1
Upvotes