Loading...

The Hostile Takeover

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

Domain
Python
Difficulty
medium
Seniority
mid, senior

Problem

Write a function that recursively merges two nested dicts. For any key present in both, if both values are dicts recurse deeper; otherwise the override value wins. Return the merged result without mutating the inputs.

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.