【LeetCode】23.Maximum depth of binary tree· 二叉树的最大深度 题目描述 英文版描述 Given the of a binary tree, return its maximum depth.A binary tree’s maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 英文版地址 https://leetcode.com/problems/maximum-depth-of-binary-tree/ 中文版描述 给定一个二叉树,找出其最大深度。二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 说明: 叶子节点是指没有子节点的节点。 示例:给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7返回它的最大深度 3 。 中文版地址 https://leetcode.cn/problems/maximum-depth-of-binary-tree/ 解题思路 设置一个变量,用于存储该树的最大深度,遍历求每一个节点的深度并与进行比较,大于则替换,小于或等于则保持不变 解题方法 俺这版 

2024最新激活全家桶教程,稳定运行到2099年,请移步至置顶文章:https://sigusoft.com/99576.html
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。 文章由激活谷谷主-小谷整理,转载请注明出处:https://sigusoft.com/63127.html