# Lowest Common Ancestor of a Binary Search Tree

> LeetCode #235 — Lowest Common Ancestor of a Binary Search Tree. Solve on LeetCode, then implement here if you want it in your drill queue.

https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/

Canonical: https://learn.significanthobbies.com/curriculum/drills/lc-lowest-common-ancestor-of-a-binary-search-tree

LeetCode #235 — Lowest Common Ancestor of a Binary Search Tree. Solve on LeetCode, then implement here if you want it in your drill queue.

https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/

## The mechanism

A tree is recursion made concrete: almost every tree problem is "solve it for the children, then combine". DFS (pre/in/post-order) is a recursion or an explicit stack; BFS is a queue, level by level. Pick the traversal that matches what you need to combine.

## Expected evidence

Pass all LeetCode test cases for this problem.

## Hints

- Pattern hint: trees.
- Start with brute force, then optimize time/space.
- Write down invariants before coding.

## Sources and practice

- [VisuAlgo — Binary Search Tree](https://visualgo.net/en/bst)
- [Study Trees](https://learn.significanthobbies.com/curriculum/concepts/trees)
- [Try the interactive drill](https://learn.significanthobbies.com/drills/lc-lowest-common-ancestor-of-a-binary-search-tree)
- [All practice briefs](https://learn.significanthobbies.com/curriculum/drills/)
