mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-10-28 02:43:08 +08:00
* refactor: clean to roadmap content * refactor: move shared helpers into scripts/lib
715 B
715 B
Lowest Common Ancestor of a BST
Given a BST and two nodes, find their lowest common ancestor. Because it is a BST, you can use the values to decide whether to go left, right, or stop: the ancestor is where the two nodes diverge. This problem teaches you to exploit BST ordering as a navigation tool, rather than doing a general tree search.
Visit the following resources to learn more: