Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Find the minimum number of edges connecting two specified nodes in an N-ary tree.
Return -1 if either target value is missing from the tree.
Leverage hierarchical tree properties to compute path length efficiently.
What This Tests
Tree traversal algorithms (DFS/BFS)
Path reconstruction and depth calculation
Lowest Common Ancestor (LCA) logic
Parent-pointer mapping and upward navigation
Common Patterns
DFS/BFS
Graph Traversal
Hashing
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Stdout
-