Interview Experience Google Frontend

The task is about a binary tree, where only leaf nodes can be selected at a time. Return the order of the selected leaf nodes in a list.

For the second question, add a condition. Parent and child nodes cannot be adjacent. If there are no other choices left, they can be adjacent only when necessary.

For the third question, based on the first question, the two children of the same parent cannot be adjacent in the returned list.

Lastly, how many total answers are there for the first question?