Loading interview...

The Hierarchy Builder

A hard Python mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.

Domain
Python
Difficulty
hard
Seniority
senior

Interview Prompt

The org chart is stored as flat parent-child pairs in a database export, and the frontend needs it as a nested JSON tree for the visualization component. Write a function that converts a flat list of (parent, child) tuples into a nested dictionary. There is exactly one root node (a parent that never appears as a child). Leaf nodes map to empty dicts. No cycles exist in the data.

How This Interview Works

  1. Read the vague prompt (just like a real interview)
  2. Ask clarifying questions to the AI interviewer
  3. Write your python solution with real code execution
  4. Get instant feedback and a hire/no-hire decision