Python data engineering interview problem. Difficulty: intermediate. Pattern: Recursion. About 15 minutes. Part of the Pro drill bank.
A directory listing is a nested tree. A backup tool wants a flat list of paths like 'src/app/main.py'.
Flatten a nested directory listing into path strings.
Input: flatten_dir({'a': {'b': None, 'c': None}, 'd': None}) Output: ['a/b', 'a/c', 'd'] This input follows the stated rules and produces this output.
Topics: lakebench, python, recursion.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Given a nested dict representing folders and files, return every full file path.
Flatten a nested directory listing into path strings.