Loading...

The Family Reunion

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

Domain
Python
Difficulty
medium
Seniority
mid, senior

Problem

A genealogy system needs to find the closest shared ancestor between two individuals in a tree. Given the root of a binary search tree and two integer values, write a function that returns the node that is the lowest common ancestor of both values.

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.