Maximum Depth of Binary Tree leetcode
来源:互联网 发布:mybatis拼接sql 编辑:程序博客网 时间:2024/06/08 05:31
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
求一个二叉树的最大长度。/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { public int maxDepth(TreeNode root) { if (root == null) { return 0; } int left = maxDepth(root.left); int right = maxDepth(root.right); return Math.max(left, right) + 1; }}
0 0
- Leetcode - Tree - Maximum Depth of Binary Tree
- [leetcode][tree] Maximum Depth of Binary Tree
- LeetCode Maximum Depth of Binary Tree
- [Leetcode] Maximum Depth of Binary Tree
- leetcode 24: Maximum Depth of Binary Tree
- [LeetCode] Maximum Depth of Binary Tree
- Leetcode 104 Maximum Depth of Binary Tree
- 【leetcode】Maximum Depth of Binary Tree
- [leetcode]Maximum Depth of Binary Tree
- [LeetCode]Maximum Depth of Binary Tree
- [leetcode]Maximum Depth of Binary Tree
- Leetcode: Maximum Depth of Binary Tree
- LeetCode-Maximum Depth of Binary Tree
- [leetcode] Maximum Depth of Binary Tree
- LeetCode - Maximum Depth of Binary Tree
- LeetCode:Maximum Depth of Binary Tree
- LeetCode | Maximum Depth of Binary Tree
- 【leetcode】Maximum Depth of Binary Tree
- tcpdump抓包实例
- TeXstudio:LaTeX模板使用
- 通道&渐变——金属按钮制作
- 使用adb devices命令,error:device offline的错误。
- windows中批量修改文件后缀名
- Maximum Depth of Binary Tree leetcode
- Permutation全排列算法
- 蓄水池抽样(reservoir sampling)
- Insight tx:annotation-driven 解析
- 微积分 —— 有限覆盖定理
- CentOS6.5安装指定的PHP版本(php5.5)
- 【9108】模拟数学计算器
- ZCMU1692 鬼吹灯
- TextView设置文本颜色