Problem List
Memorized at this point. For the record I am not merely copying the dfs func from previous challenges. I am rewriting it each time.
O(n) O(n + h) - h is height of tree, if its nothing more than a degenerate linked listfunc postorder(root *Node) []int {
var res []int
var dfs func(node *Node)
dfs = func(node *Node) {
if node == nil {
return
}
for _,child := range(node.Children) {
dfs(child)
}
res = append(res, node.Val)
}
dfs(root)
return res
}