1883. Find Distance in a Binary Tree

Medium
Hash Table
Tree
Depth-First Search
Breadth-First Search
Binary Tree

Description

Hints

Hint 1
Get the LCA of p and q.
Hint 2
The answer is the sum of distances between p-LCA and q-LCA

Statistics

Acceptance
74.4%
Submissions
48,450
Accepted
36,029