← Questions

Decide whether two people in a family tree are related

0
GoogleCodingLast asked Jan 2026

You get a family tree as parent and child links. Given two people in it, decide whether they are related through the tree. Agree on what "related" means with the interviewer (for example, sharing an ancestor), then give the time and space of your approach.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding