LeetCode Daily Problems: Binary Tree Traversals and Construction
590. N-ary Tree Postorder Traversal
Approach: Right-to-left, then root-to-left. Use a stack with a visited set to track processed nodes.
class Node:
def __init__(self, val=None, children=None):
self.val = val
self.children = children
def postorder(root):
if not root:
return []
stack = [root]
result = []
...
Posted on Thu, 09 Jul 2026 16:38:30 +0000 by balacay