← Amazon questions
CodingReported in a candidate post, Mar 2021

Lowest common ancestor in a binary tree with a modification

Filed under Amazon

Given a binary tree and two nodes p and q that both exist in the tree, find their lowest common ancestor (LCA): the deepest node that has both p and q as descendants (a node may be a descendant of…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.