Fetching data...
This may take a moment
Back
1883. Find Distance in a Binary Tree
Medium
Hash Table
Tree
Depth-First Search
Breadth-First Search
Binary Tree
Solve on LeetCode
View Solutions
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
Similar Questions
Step-By-Step Directions From a Binary Tree Node to Another
Medium
Statistics
Acceptance
74.2%
Submissions
47,312
Accepted
35,117