leetocde-Maximum Depth of Binary Tree
2015-11-06 00:13
405 查看
Difficulty:
Easy
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.
Easy
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.
class Solution { public: int maxDepth(TreeNode* root) { return root?max(maxDepth(root->left),maxDepth(root->right))+1:0; } };
相关文章推荐
- 抽取出的BaseService,以及实现类中调用的原理
- linux:服务
- 实战:搭建CA认证中心,使用CA证书搭建HTTPS
- Struts2+ajax之form表单提交实例
- Ubuntu解压缩zip,tar,tar.gz,tar.bz2
- 膝盖中了一箭之康复篇第四个月
- 个人经过多方查询所得关于懒加载的一些浅薄认识,及如何设置随机颜色,让个人界面变得多彩
- Fragment官方解析
- Fragment官方解析
- 一年管理成富翁,三年销售路路通,十年技术一场空
- 面试经历---铂涛集团(2015年10月17日下午)
- 回射客户端服务器select 修改版[1]( echo client && server improved by select function)
- 对threading模块源码文件的解读(不全)
- leetcode-Minimum Depth of Binary Tree
- 数组生成序列不重复随机数
- Codeforces Round #329 (Div. 2)A 字符串处理
- Java性能调优
- READING NOTE: Joint Tracking and Segmentation of Multiple Targets
- VMware11安装OSX10.10虚拟机
- 电磁波