Go | 0ms | beats 100% | DFS
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a Node.\n * type Node struct {\n *     Val int\n *     Children []*Node\n * }\n */\n\nfunc postorder(root *Node) []int {\n    post := []int{}\n    dfs(root, &post)\n    return post\n}\n\nfunc dfs(node *Node, post *[]int) {\n    if node == nil {\n        return\n    }\n    if len(node.Children) > 0 {\n        for _, c := range node.Children {\n            dfs(c, post)\n        }\n    }\n    *post = append(*post, node.Val)\n}\n```
['Go']