Python data engineering interview problem. Difficulty: advanced. Pattern: Dictionaries. About 20 minutes. Part of the Pro drill bank.
A product catalog is published as two versions. Merchandising wants what was added, removed, or changed so they can write a changelog.
Diff two versions of a product catalog.
Input: catalog_diff({'A': {'name': 'a', 'price': 1}}, {'A': {'name': 'a', 'price': 2}, 'B': {'name': 'b', 'price': 3}}) Output: {'added': ['B'], 'removed': [], 'changed': ['A']} This input follows the stated rules and produces this output.
Topics: lakebench, python, data-transformation.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Given two snapshots of a product catalog, report which products were added, removed, or changed.
Diff two versions of a product catalog.