Lowest common ancestor in an N-ary tree

0
Remix

Given the root of an N-ary tree and two of its nodes, return their lowest common ancestor. Use one depth-first pass in which each subtree reports whether it contains each of the two nodes.

Scale AITechnical phone screenLast asked Dec 2025
No answer yet. Write the first one; the best answer gets endorsed.