/**
* Definition for a Node.
* type Node struct {
* Val int
* Children []*Node
* }
*/
func postorder(root *Node) []int {
var stack []int
if root == nil {
return stack
}
for _, child := range root.Children {
stack = append(stack, postorder(child)...)
}
stack = append(stack, root.Val)
return stack
}