Cursor·Software Engineer·Technical Phone Screen
- Implement a Merkle tree that mirrors a real directory structure on disk, where each directory is an internal node and each file is a leaf. You must read actual files using only standard library functions and compute hashes accordingly.
- Given two snapshots of the same repository, produce a diff showing which files were added, modified, or removed between the two states.
- How would you handle large directories efficiently to avoid rehashing unchanged subtrees when comparing two snapshots?
- How would your implementation handle edge cases like symlinks, empty directories, and binary files?
“This tripped me up early because I kept thinking about it as a binary tree.”