Find path from leaf to leaf


Given an arbitrary n-ary tree and two leaves but not the root, find the path from one leaf to the other leaf. Note that the tree is “bidirectional”; that is, each node has a reference to both its children and its parent.


Answer