...

/

DIY: Lowest Common Ancestor of a Binary Tree

DIY: Lowest Common Ancestor of a Binary Tree

Solve the interview question "Lowest Common Ancestor of a Binary Tree" in this lesson.

Problem statement

You are given a binary tree and two nodes within it. Your task is to find the lowest common ancestor (LCA) of the two given nodes.

Note: The lowest common ancestor of two ...