Golang | Leetcode Golang题解之第559题N叉树的最大深度
题目:
题解:
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
}