← Flipkart questions
CodingMediumReported in a candidate post, Jul 2024

Lowest common ancestor of a binary tree

Filed under Flipkart · Also reported at ixigo, Swiggy, Zeotap

Given the root of a binary tree and two nodes p and q that exist in the tree, return their lowest common ancestor: 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 Flipkart questions

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