Extract Leaf Values
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
A service's runtime configuration arrives as a nested dict `config` where each value is either a subsection (another dict) or a plain setting value at the bottom. Return every plain setting value in one flat list, ordered by where it sits: read each dict's keys top to bottom, and a subsection's values come out before the values of any sibling keys that follow it.
Summary
The tree has leaves. Pluck 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.