Problem 1123 · Medium

Lowest Common Ancestor of Deepest Leaves

Each subtree reports its deepest leaf depth and that depth’s common ancestor; equal depths on both sides mean the current node is the answer.

Open the interactive visualisation