leetcode 104. Maximum Depth of Binary Tree
2015-02-17 19:29
330 查看
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]
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
[Solution]
int maxDepth(TreeNode *root) { if (root == NULL) return 0; return max(maxDepth(root->left), maxDepth(root->right)) + 1; }
相关文章推荐
- [LeetCode] 111. Minimum Depth of Binary Tree
- [leetcode] 111. Minimum Depth of Binary Tree
- LeetCode 111. Minimum Depth of Binary Tree
- Leetcode-111. Minimum Depth of Binary Tree
- leetcode 543. Diameter of Binary Tree
- LeetCode-111. Minimum Depth of Binary Tree
- 【leetcode】111. Minimum Depth of Binary Tree
- [leetcode]#111. Minimum Depth of Binary Tree
- 【LeetCode】104. Maximum Depth of Binary Tree
- LeetCode 104. Maximum Depth of Binary Tree
- LeetCode 111. Minimum Depth of Binary Tree
- [leetcode] 104. Maximum Depth of Binary Tree
- leetcode-111. Minimum Depth of Binary Tree
- Leetcode 111. Minimum Depth of Binary Tree
- LeetCode 543. Diameter of Binary Tree
- LeetCode 111. Minimum Depth of Binary Tree
- 【LeetCode】111.Minimum 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