Coding

Maximum Depth of an N-ary Tree

Find the maximum depth of an N-ary tree.

Input: root = [1,null,2,null,3,null,4]

Output: 4

Explanation: The tree is essentially a straight line, requiring a traversal that reaches a maximum depth of 4 layers.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

Community Answers

1 answer from the community

Unlock Full Access

Answer any un-answered question from our database to unlock all community answers for 30 days.

Give & Take

Practice More Questions

2 answers published. Last candidate submission on Oct 10 2026, 5:03am PDT. Interview question asked to Software Engineers interviewing at Appian, Turo, NetSuite and other companies. Original question asked: Maximum Depth of an N-ary Tree. Question last reported by a candidate interviewing at Strava for a Software Engineer interview on Sep 25 2026, 1:26pm PDT.