Lowest Common Ancestor of a Binary Tree
Problem Statement Given a binary tree, and two values v1 and v2, find the lowest common ancestor of nodes with their values as v1 and v2. Where the lowest common ancestor of two nodes (Node1 and Node2) is the deepest node of which Node1 and Node2 are descendants. Note that here we consider that a node is the descendant of itself also. Examples Example 1 – Input ...