Lowest Common Ancestor of a Binary Tree at Meta

Medium68.7% acceptance

This problem has 87.5% frequency at Meta.

Problem Description

Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the [definition of LCA on Wikipedia](<https://en.wikipedia.org/wiki/Lowest_common_ancestor>): “The lowest common ancestor is defined between two nodes `p` and `q` as the lowest node in `T` that h...

Read full problem and hints

Topics

Also asked at 22 companies


More Meta Questions

View all Meta questions