题目:
题解:
func maxDepth(root *Node) (ans int) {if root == nil {return}queue := []*Node{root}for len(queue) > 0 {q := queuequeue = nilfor _, node := range q {queue = append(queue, node.Children...)}ans++}return
}
题目:
题解:
func maxDepth(root *Node) (ans int) {if root == nil {return}queue := []*Node{root}for len(queue) > 0 {q := queuequeue = nilfor _, node := range q {queue = append(queue, node.Children...)}ans++}return
}