The Schema Diff
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Given dicts d1 and d2, return a dict with three keys: 'added' (a dict of keys present only in d2, mapped to their d2 values), 'removed' (a dict of keys present only in d1, mapped to their d1 values), and 'changed' (a dict of keys present in both but whose values differ, each mapped to a two-element list [d1_value, d2_value]). Keys present in both with equal values are omitted. If the dicts are identical, all three sub-dicts are empty.
Summary
Two versions of the same config - what changed between them?
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.