Available question text
Compute the diameter (longest path in edges between any two nodes) of an N-ary tree by using a post-order traversal to obtain subtree heights and combining the two largest child heights at each node to update a global maximum; this is a tree/DFS problem solvable in O(n) time and O(h) recursion space.
Related questions
Continue with questions that share topics or the same question type.
- Clone N-ary Tree
Coding
- Diameter of Binary Tree
Coding · Binary Tree · Depth-First Search · DP on Trees
- Encode N-ary Tree to Binary Tree
Coding
- Find Root of N-Ary Tree
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
Google
Leetcode 1522. Diameter of N-Ary Tree
Reported Dec 11, 2024 · 1 source report
MID_LEVEL
Source snapshot: Nov 12, 2026
View source