Join Nostr
2026-10-27 15:07:54 UTC

codementor on Nostr: Question: In a binary tree (not a search tree), find the first common ancestor of two ...

Question: In a binary tree (not a search tree), find the first common ancestor of two nodes: the lowest node that has both of them below it (a node counts as below itself).

There are no parent links, and you may not store nodes in an extra data structure.

(CtCI 4.8)

Try to answer before you open the reply.

#tg008 · TG-008-Q1