Files
2025-08-26 06:18:10 +08:00

20 lines
258 B
Go

package main
type TreeNode struct {
Val int
Left *TreeNode
Right *TreeNode
}
func main() {}
func maxDepth(root *TreeNode) int {
if root == nil {
return 0
}
maxnum := 1
maxnum += max(maxDepth(root.Left), maxDepth(root.Right))
return maxnum
}