Maximum Depth of Binary Tree
来源:互联网 发布:如何学英语 知乎 编辑:程序博客网 时间:2024/04/27 07:30
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: int maxDepth(TreeNode *root) { if(root==NULL) { return 0; } int ldepth=maxDepth(root->left); int rdepth=maxDepth(root->right); return ldepth>rdepth?ldepth+1:rdepth+1; }};
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
- Android Studio 离线安装 Gradle 的方法
- 安装配置Hadoop的各个配置文件修改的地方以及修改的内容
- 每个程序猿都有一个源码梦
- TCP/IP卷一 RARP协议
- Unity3D基础--常用的GUI控件
- Maximum Depth of Binary Tree
- Libevent:5events相关
- 我的创业之路
- ACM 中的期望,概率 问题
- 开始写博客咯,一天一更,求监督
- Python mysql插入数据
- 如何在ADT中调试Android程序
- 出栈序列统计
- 【树链剖分】FZU 2082 过路费 求和