LeetCode 104. 二叉树的最大深度 104. 二叉树的最大深度解题思路 参考代码1234567891011class Solution { public int maxDepth(TreeNode root) { if(root == null) { return 0; } int maxL = maxDepth(root.left); int maxR = maxDepth(root.right); return Math.max(maxL, maxR) + 1; }} LeetCode LeetCode 104. 二叉树的最大深度 https://sowink.cn/2026/02/08/LeetCode-104-二叉树的最大深度/ 作者 Xurx 发布于 2026年2月8日 许可协议 LeetCode 102. 二叉树的层序遍历 上一篇 LeetCode 105. 从前序与中序遍历序列构造二叉树 下一篇 Please enable JavaScript to view the comments