← Questions

Lowest common ancestor of a binary tree

0
AmazonMetaCodingLast asked Sep 2026

A coding interview question asked in Meta's technical phone screen and at Amazon, last asked Sep 2026. It tests trees and recursion.

Given a binary tree whose values have no ordering, and two distinct nodes in it, return their lowest common ancestor: the deepest node that has both nodes in its subtree. A node counts as part of its own subtree.

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

  • Meta · Technical phone screen · Last asked Sep 202645 min · Two coding problems in CoderPad, about 20 minutes each · Usually no AI; some newer screens are AI-assisted
  • Amazon · Technical phone screen · Last asked Aug 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI

What it tests

trees · recursion

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