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.2%
Submissions
47,312
Accepted
35,117