跳转至

LC104 - 二叉树的最大深度

MaximumDepth.go
package BinaryTree

func maxDepth(root *TreeNode) int {
    if root == nil {
        return 0
    }
    leftRet := maxDepth(root.Left)
    rightRet := maxDepth(root.Right)
    return 1 + max(leftRet, rightRet)
}