15算法课程 104. Maximum Depth of Binary Tree
来源:互联网 发布:淘宝ashford代购水深 编辑:程序博客网 时间:2024/06/06 00:05
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.
solution:递归
code:
class Solution {public: int maxDepth(TreeNode* root) { return root == NULL ? 0 : max(maxDepth(root -> left), maxDepth(root -> right)) + 1; }};
阅读全文
0 0
- 15算法课程 104. Maximum Depth of Binary Tree
- 【算法作业4】LeetCode 104. Maximum Depth of Binary Tree
- 15算法课程 111. Minimum Depth of Binary Tree
- [LeetCode]104.Maximum Depth of Binary Tree
- 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
- 104.Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- 104.Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- leetCode 104. Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree
- 104. Maximum Depth of Binary Tree LeetCode
- 104. Maximum Depth of Binary Tree LeetCode
- MPLS VPN简单介绍
- LinkedList 常用功能
- 2.Oracle杂记——详细的动态视图与数据词典
- 浅谈synchronized、wait、notify和notifyAll
- NOIP2017赛前模拟(2017.10.20)
- 15算法课程 104. Maximum Depth of Binary Tree
- 高斯消元—— 【模板】高斯消元法
- 3.Oracle杂记——数据字典dba_data_files
- 4.Oracle杂记——数据字典dba_db_links
- 数据结构 P48 算法实现 栈的应用举例-数制转换
- NOIP2015 T6 运输计划 【树上差分】
- 51nod 1098 最小方差 排序+前缀和+期望方差公式
- 数据结构之 单链表的基本操作(创建、取值、插入、删除)
- Hibernate 实现增删改查案例