1883. Find Distance in a Binary Tree

Medium
Hash Table
Tree
Depth-First Search
Breadth-First Search
Binary Tree
Binary Lifting
Lowest Common Ancestor

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,961
Accepted
36,412