590. N-ary Tree Postorder Traversal
590. N-ary Tree Postorder Traversal
"""
# Definition for a Node.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
class Solution:
def postorder(self, root: 'Node') -> List[int]:
if not root:
return []
res = []
for child in root.children:
res.extend(self.postorder(child))
res.append(root.val)
return res