Leetcode 559 - Max depth of n-ary tree

Note:

• Input is not an array, it’s still a root node but shown in a serialized array.
• Do DFS on each child in children
• Do Max on result of each dfs(child).

Question:

Given a n-ary tree, find its maximum depth.

The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).

Example:

Code: