139. N-Ary Tree Postorder Traversal

Given the root of an n-ary tree root. Return the node values in postorder traversal: children left to right first, then the root. The tree is given in the format: [root, null, root_children, null, next_node_children, ...].
Example 1
Input: root = [1]
Output: [1]
Explanation: Tree with a single node.
Example 2
Input: root = [1,null,3,2,4,null,5,6]
Output: [5,6,3,2,4,1]
Explanation: Postorder: children left to right, then root.
easyn-ary treerecursionstacktree
JavaScript
Loading...
Line 1, Char 1