Loading...

The File Tree Builder

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

Domain
Python
Difficulty
medium
Seniority
senior

Problem

Your deploy pipeline logs every file path that changed in the latest release. For the post-deploy audit dashboard, you need to reconstruct the directory tree from flat path strings. Write a function that takes a list of file paths and builds a nested dictionary representing the directory structure, where leaf files map to null.

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.