Do Two Individuals Share a Common Ancestor?

Asked at Google · Coding Questions · Difficulty: Easy

Given a family tree stored as a parent map, decide whether two individuals are related, meaning that they have at least one common ancestor.

Loading the problem…