@@ -0,0 +1,837 @@
+package leetcode;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * https://leetcode.com/problems/n-ary-tree-preorder-traversal/%0A */%0Apublic class Problem589 %7B%0A    private static class Node %7B%0A        public int val;%0A        public List%3CNode%3E children;%0A%0A        public Node() %7B%0A        %7D%0A%0A        public Node(int _val, List%3CNode%3E _children) %7B%0A            val = _val;%0A            children = _children;%0A        %7D%0A    %7D%0A%0A    public List%3CInteger%3E preorder(Node root) %7B%0A        List%3CInteger%3E result = new ArrayList%3C%3E();%0A        preOrder(root, result);%0A        return result;%0A    %7D%0A%0A    private static void preOrder(Node root, List%3CInteger%3E result) %7B%0A        if (root == null) %7B%0A            return;%0A        %7D%0A        result.add(root.val);%0A        for (Node node : root.children) %7B%0A            preOrder(node, result);%0A        %7D%0A    %7D%0A%7D%0A

Solve problem 589