1780. Lowest Common Ancestor of a Binary Tree II

Medium
Tree
Depth-First Search
Binary Tree

Description

Hints

Hint 1
Traverse the graph visiting root, left, root, right, root to make an Euler Path
Hint 2
Return the node (LCA) that is at the lowest depth between p and q in the Euler Path

Statistics

Acceptance
69.5%
Submissions
172,620
Accepted
120,026