AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
[TOC] ## 二叉树的最大深度 ``` /** * Definition for a binary tree node. * type TreeNode struct { * Val int * Left *TreeNode * Right *TreeNode * } */ func maxDepth(root *TreeNode) int { if root ==nil{ return 0 } left:=maxDepth(root.Left) right:=maxDepth(root.Right) return max(left,right)+1 } func max(a,b int)int{ if a>b{ return a } return b } ```