← Questions

Lowest common ancestor in a binary search tree

0
AmazonCodingLast asked Sep 2026

A coding interview question asked in Amazon's technical phone screen, last asked Sep 2026. It tests trees and binary search tree.

Given a binary search tree and two distinct keys p and q that are both in it, return their lowest common ancestor: the node farthest from the root whose subtree contains both. A node's subtree includes the node itself, so if one key is an…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Amazon · Technical phone screen · Last asked Sep 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI

What it tests

trees · binary search tree

Your code and the AI tutor open when you unlock this question.