LeetCode 104 Maximum Depth of Binary Tree JAVA
来源:互联网 发布:网络电视需要什么设备 编辑:程序博客网 时间:2024/05/16 04:47
代码如下,递归。
public class Solution {
public int maxDepth(TreeNode root) {if (root == null) return 0;
int left = maxDepth(root.left);
int right = maxDepth(root.right);
return 1 + (left > right ? left : right);
}
}
0 0
- [Leetcode] Maximum Depth of Binary Tree (Java)
- [LeetCode][Java] Maximum Depth of Binary Tree
- LeetCode|Maximum Depth of Binary Tree-java
- (java)leetcode Maximum Depth of Binary Tree
- leetcode:Maximum Depth of Binary Tree 【Java】
- Leetcode 104 Maximum Depth of Binary Tree
- LeetCode(104)Maximum Depth of Binary Tree
- LeetCode 104 Maximum Depth of Binary Tree
- LeetCode: Maximum Depth of Binary Tree [104]
- Leetcode(104)Maximum Depth of Binary Tree
- [leetcode 104] Maximum Depth of Binary Tree
- LeetCode 104 Maximum Depth of Binary Tree
- leetCode #104 Maximum Depth of Binary Tree
- LeetCode 104: Maximum Depth of Binary Tree
- LeetCode 104 Maximum Depth of Binary Tree
- leetcode || 104、Maximum Depth of Binary Tree
- LeetCode 104: Maximum Depth of Binary Tree
- leetcode[104]:Maximum Depth of Binary Tree
- 基于分布式hadoop的机器学习算法工具包
- socket编程原理
- C++ typedef
- 批量自动替换源码文件中的自动添加内容或者注释 或者其他特殊内容
- Linux学习笔记之网络管理
- LeetCode 104 Maximum Depth of Binary Tree JAVA
- Android 浏览器点击链接打开本地应用(APP)并拿到浏览器传递的数据
- 设计模式之观察者模式
- bzoj1020 安全的航线flight
- Cell嵌套UITableView自动布局
- Metasploit 对 IE 浏览器的极光漏洞进行渗透利用
- 欢迎使用CSDN-markdown编辑器
- tomcat启动报JDWP异常
- position的四个属性值