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.

Practice More Questions

Interview question asked to Software Engineers interviewing at Vodafone, Souq, HomeAway and other companies. Original question asked: Maximum Depth of an N-ary Tree.