← Questions
Throne inheritance without an initial king
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Model a royal family's line of succession: people are born to parents, people die, and you return the current order of inheritance (a pre-order walk of the family tree that skips the dead). This is the classic throne-inheritance design, with a twist: the constructor does not give you a king, so the structure must start empty and decide who the root is as people are added.
Explain how the twist changes your data structures and edge cases.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
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
