Lowest Common Ancestor of a Binary Tree

IF
AlgoAxiomStaff Engineers
JSTS
Medium20 mins

Given a binary tree, find the lowest common ancestor of two given nodes in the tree.

Source: Tree Depth-First Search pattern — AlgoAxiom
JavaScript
Test Case 1
root = [1, 2, 3]
Test Case 2
root = [1, 2, 3, 4, 5]
Idle