...

/

Lowest Common Ancestor of a Binary Tree

Lowest Common Ancestor of a Binary Tree

Try to solve the Lowest Common Ancestor of a Binary Tree problem.

Statement

Given the root node of a binary tree with nn nodes, your task is to find the lowest common ancestor of two of its nodes, p and q.

Note: The lowest common ancestor of two nodes, ...