Python data engineering interview problem. Difficulty: intermediate. Pattern: Dictionaries. About 15 minutes. Part of the Pro drill bank.
Service config is a nested dict. A deploy overlay should override matching keys and leave unspecified keys from the base intact, including nested maps.
Merge two JSON-like dicts so overlay keys win, recursively for nested dicts.
Input: deep_merge({'a': 1, 'b': {'c': 2}}, {'b': {'d': 3}, 'e': 4}) Output: {'a': 1, 'b': {'c': 2, 'd': 3}, 'e': 4} This input follows the stated rules and produces this output.
Topics: lakebench, python, JSON-like-data.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Merge a base config dict with an override dict, letting override values win at every nesting level.
Merge two JSON-like dicts so overlay keys win, recursively for nested dicts.