Lowest Common Ancestor in a Search Tree

Talk it through out loud with your AI coach.

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.