import . "nc_tools"
/*
 * type TreeNode struct {
 *   Val int
 *   Left *TreeNode
 *   Right *TreeNode
 * }
 */

/**
  * 
  * @param root TreeNode类 
  * @return int整型
*/
//递归选手请求出战
func maxDepth( root *TreeNode ) int {
    // write code here
    return maxD(root)
}

func maxD(root *TreeNode) int {
    if root == nil {
        return 0
    }
    var res int
    left := maxD(root.Left)
    right := maxD(root.Right)
    res = max(left, right) + 1
    return res
}

func max(a, b int) int {
    if a < b {
        return b
    }
    return a
}