[leetcode] Maximum Depth of Binary Tree
来源:互联网 发布:网络银商最重的判刑 编辑:程序博客网 时间:2024/04/30 09:32
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) {// Start typing your C/C++ solution below// DO NOT write int main() functionint left,right;if(root==NULL)return 0;return (left=maxDepth(root->left))>(right=maxDepth(root->right))?left+1:right+1;}};
求二叉树的高
- 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
- Linux和DOS命令对比
- 技术面试时,那些令人心虚的问题
- linux线程相关函数
- zoj 3725
- 多校第八场
- [leetcode] Maximum Depth of Binary Tree
- dp--upc2447
- Tomcat类似Weblogic,管理自己的domains
- 【C/C++】Linux下system()函数引发的错误
- T-sql(SQL Server)
- ActivityManagerService分析
- 【C/C++】Linux下使用system()函数一定要谨慎
- 部署Wiki类系统Corendal Wiki的一点经验
- 数据库设计范式深入浅出