1740. Find Distance in a Binary Tree
Hash TableTreeDepth-First SearchBreadth-First SearchBinary TreeBinary LiftingLowest Common Ancestor
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
Preparing judge…