← Questions
Deduplicate files by size then content hash
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Walk a directory tree and group files with identical content. Compare file sizes first so large files are hashed only when sizes collide, then hash the rest. Be ready to discuss I/O versus CPU cost, hash choice, and how the design changes at very large scale.
def find_duplicates(root):
"""Return sorted groups (sorted lists of 2+ paths) of files with identical bytes under root."""
Sign in to see the worked answer
The full answer, chapter by chapter, with what interviewers expect at each level. Free with an account: one full answer per company.
Sign in to see the worked answer
The full answer, chapter by chapter, with what interviewers expect at each level. Free with an account: one full answer per company.
Sign in to submit your code; every attempt is kept here.
Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding


