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
Coding & Algorithms
Software Engineer
Replit
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

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
hash maps
set operations
rename detection
snapshots
deterministic output
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported

Related Questions