Example 1

Example 2

The number of nodes in the tree is in the range [0, 104].0 <= Node.val <= 104The height of the n-ary tree is less than or equal to 1000.Example 1

Example 2

The number of nodes in the tree is in the range [0, 104].0 <= Node.val <= 104The height of the n-ary tree is less than or equal to 1000.