# Leetcode 589 - N-ary tree preorder traversal

Note:

• Recursive way is too easy, let’s user iterative.
• Use stack.
• Add children backwards using pop().

Question:

Given the root of an n-ary tree, return the preorder traversal of its nodes’ values.

Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the null value (See examples)

Example:

Code: