Ezvor

1257. Smallest Common Region

MediumArray Preparing judge… LeetCode
ArrayHash TableStringTreeDepth-First SearchBreadth-First SearchBinary LiftingLowest Common Ancestor

Hints

Hint 1
Try to model the problem as a graph problem.
Hint 2
The given graph is a tree.
Hint 3
The problem is reduced to finding the lowest common ancestor of two nodes in a tree.