DataDriven
LearnPracticeInterviewDiscussDailyJobs

The Hierarchy Builder

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

Domain
Python
Difficulty
hard
Seniority
L5

Problem

Given a list of [parent, child] pairs, build a nested dict tree. The root is the parent that never appears as a child. Each parent maps to a dict of its children (by name). Leaves have empty dicts {}. Assume a single root.

Summary

Parent-child pairs, flat. Build the family tree.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons