func TreeDepth( pRoot *TreeNode ) int {
// write code here
var a,b int
if pRoot==nil {
return 0
}
a = TreeDepth(pRoot.Left)
b = TreeDepth(pRoot.Right)
return Max(a,b)+1
}
func Max(a,b int) int {
if a > b {
return a
} else {
return b
}
}
京公网安备 11010502036488号