func maxDepth(root *TreeNode) int {
if root == nil {
return 0
}
return max(maxDepth(root.Left),maxDepth(root.Right))
}
func max(a int, b int) int {
if a > b {
return a
}
return b
}
力扣算法21-二叉树的最大深度
最新推荐文章于 2021-03-05 00:26:23 发布