Lowest Common Ancestor of a BST

Trees · BST · Use ordering to choose one branch · Easy · about 22 min

Why it matters

This is a confidence-building example of using a data-structure guarantee directly.

How it connects

BST bounds validated a tree. Now BST ordering tells you exactly where the shared ancestor must be.

Try first

If both target values are smaller than root, where can their common ancestor be?

Interview cue

BST ordering lets me discard one whole subtree at each step.