leetle

Daily challenge for 2025-10-15

288. Maximum Depth of N-ary Tree

Given an n-ary tree represented as a nested list structure where each node is [value, [child1, child2, ...]], return the maximum depth of the tree. The depth is the number of nodes along the longest path from the root to the farthest leaf. An empty tree has depth 0.

Example:
Input: root = [1,[[3,[[5,[]],[6,[]]]],[2,[]],[4,[]]]]
Output: 3

Run this challenge interactively in Python or JavaScript when the app loads.