Problem 589 · Easy

N-ary Tree Preorder Traversal

Return the values of an N-ary tree in root-first order, keeping children from left to right. The visual uses a stack, outputs each node, and pushes its children in reverse so the leftmost is processed next.

Open the interactive visualisation