← Questions

Deduplicate files by size then content hash

0
AnthropicHarveyOpenAI+1CodingLast asked Sep 2026

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."""
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