Loading...

The Change Tracker

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.

Domain
Python
Difficulty
medium
Seniority
junior, mid, senior

Problem

Our data warehouse tracks slowly changing dimensions. Write a function called detect_changes that takes two lists of dictionaries (old records and new records). Each dictionary has an 'id' key. Return a dictionary with three keys: 'added' (ids in new but not old), 'removed' (ids in old but not new), and 'modified' (ids in both where any other field differs). Each value should be a sorted list of ids.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.