Lowest Common Ancestor in a Search Tree

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

Given a binary search tree and two of its nodes, find their lowest common ancestor: the deepest node that has both as descendants, where a node counts as its own descendant. Explain how the ordering helps.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →