code: func (n *TreeNode) Walk(callback func(node, parent *TreeNode) bool) *TreeNode {
  	n.parent = nil
  	nodes := []*TreeNode{n}
  	for len(nodes) > 0 {
  		// Pop the top node and process it.
  		node := nodes[len(nodes)-1]
  		nodes = nodes[:len(nodes)-1]
  		if !callback(node, node.parent) {
  			// Don't add any children.
  			continue
  		}
  
  		// Add children in reverse order.
  		for index := len(node.children) - 1; index >= 0; index-- {
  			node.children[index].parent = node
  			nodes = append(nodes, node.children[index])
  		}
  	}
  
  	return n
  }
docs: // Walk traverses this node's subtree in depth-first, pre-order (NLR) order and
  // calls the provided callback function on each traversed node (which includes
  // this node) with the traversed node and its parent node (nil for this node).
  // The callback returns whether traversal should continue with the traversed
  // node's child nodes (true) or not recurse any deeper (false).