What the Night Changed
A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L5
Problem
A nightly job dumps a dimension table to a `list[dict]` and hands you two of them: `old_snapshot` from yesterday's run and `new_snapshot` from today's, where each row carries an `id_field` key that identifies it across runs. Return a dict that splits the differences into `inserts` (ids seen only today), `deletes` (ids gone since yesterday), and `updates` (ids present in both runs whose other fields moved), with every bucket sorted by `id_field` ascending.
Summary
Two photographs of the same table, a day apart. Account for everything that moved.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.