【LeetCode】104. Maximum Depth of Binary Tree
来源:互联网 发布:淘宝卖家骂人扣几分 编辑:程序博客网 时间:2024/06/06 17:56
- 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.
/** * Definition for a binary tree node. * 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; return max(maxDepth(root->left),maxDepth(root->right))+1; }};
0 0
- [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
- LeetCode 104. Maximum 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
- 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
- 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
- Leetcode 104. Maximum Depth of Binary Tree
- LeetCode *** 104. Maximum Depth of Binary Tree
- cout格式化输出
- c项目3
- 产品与运营之应用商店推广的整体流程
- Redis之Zset
- C#利用反射获取对象属性值
- 【LeetCode】104. Maximum Depth of Binary Tree
- 消费者本地事务
- CSS 背景的颜色的线性渐变
- 数据结构 12 连续存储数组的算法演示
- struts2——action返回参数的方法总结
- HTML入门学习笔记--体验CSS(1)
- P1126 机器人搬重物
- 一份年总结的感想
- python+处理日志+处理URL防止SQL注入