Summarize Agent Checkpoint Changes Between Two File Snapshots
Last updated: November 29, 2026
Quick Overview
Given two snapshots of a project as dictionaries mapping file path to file content, return which files were added, removed, modified, and renamed (a removed file whose exact content reappears at a new path).
Replit
November 29, 20260
0
0 solved
Given two snapshots of a project as dictionaries mapping file path to file content, return which files were added, removed, modified, and renamed (a removed file whose exact content reappears at a new path).
Replit Agent saves checkpoints as it builds an app, and users roll back or review what changed between them, so a clean snapshot diff is a natural warm-up. The interviewer checks set reasoning, deterministic output, and whether you notice that a move should not show up as one delete plus one add.
What the Interviewer Expects
- Uses set differences on the key sets instead of nested loops
- Separates modified (same path, new content) from renamed (new path, same content)
- Produces sorted, deterministic output suitable for a UI
- Handles duplicate content among removed files without double pairing
- States linear time in the number of files plus content hashing cost
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you detect a rename where the file was also slightly edited?
- Snapshots hold 50,000 files and large binaries. How do you avoid comparing full contents?
- How would you show a line-level diff for modified files lazily?
- How would you treat directories that were renamed as a whole?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: old and new, each {path: content}. Output four lists: added, removed, modified, renamed (pairs (old_path, new_path)). A rename is a removed path whose content exactly matches an...
High-Level Design
Compute key sets. added = new - old, removed = old - new, modified = shared paths with different content. Then index removed files by content and walk added files in sorted order: if a removed f...