Lowest common ancestor of a binary tree

0
Remix

Given a binary tree (no ordering on the values) and two of its nodes, return their lowest common ancestor: the deepest node that has both in its subtree.

AmazonMetaTechnical phone screenLast asked Sep 2026
No answer yet. Write the first one; the best answer gets endorsed.