Implement a Family Tree
Given a Person class and a FamilyTree class, implement the getAncestors method on Person and the areRelated and commonAncestors methods on FamilyTree.
Asked at:
SoFi
Microsoft
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late April, 2026
Microsoft
Junior
Late March, 2026
Microsoft
Junior
(1) Create a family tree class and write a function to check if two people are blood relatives by finding out if they have any ancestors in common. (2) Write test-cases considering all the edge cases to verify if the method works as intended.
Mid February, 2026
SoFi
Senior
Given a Person class with `getAncestors` stub and a FamilyTree class with `areRelated` and `commonAncestors` stubs, implement. This was in Java and, interestingly enough, the interviewer allowed explicit use of AI.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.