Maximum Depth of Binary Tree
来源:互联网 发布:财经日历重要数据解读 编辑:程序博客网 时间:2024/05/29 12:40
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution { int count = 0; int max = 0; public int maxDepth(TreeNode root) { count++; if(root != null) { maxDepth(root.left); count--; max = Math.max(max,count); maxDepth(root.right); count--; max = Math.max(max,count); } return max; }}
0 0
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- Maximum Depth of Binary Tree
- 常见排序算法的稳定性分析和结论
- neo4j图数据库入门
- inner join、left join 与right join的区别
- 模拟扔硬币的结果
- PLSQL10注册码
- Maximum Depth of Binary Tree
- 链接·七
- 《Node.js简记》 安装Node.js并实现Helloworld
- EOJ 3247 铁路修复计划 题解
- Android基于wheelView的自定义日期选择器(可拓展样式)
- 解决 Git 在 windows 下中文乱码的问题(转载)
- canvas 画圆 角度问题
- spark 2.1 MemoryPool, StoragememoryPool
- 微信小程序页面跳转三种方式