Ezvor

1650. Lowest Common Ancestor of a Binary Tree III

MediumHash Table Preparing judge… LeetCode
Hash TableTwo PointersTreeBinary TreeBinary LiftingLowest Common Ancestor

Hints

Hint 1
Store the path from p to the root.
Hint 2
Traverse the path from q to the root, the first common point of the two paths is the LCA.