原文:[LeetCode] 104. Maximum Depth of Binary Tree 二叉树的最大深度

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. Note:A leaf is a node with no children. ...

2014-10-26 07:32 9 17322 推荐指数:

查看详情

LeetCode:111_Minimum Depth of Binary Tree | 二叉树的最小深度 | Easy

要求:此题正好和Maximum Depth of Binary Tree一题是相反的,即寻找二叉树的最小的深度值:从根节点到最近的叶子节点的距离。 结题思路:和找最大距离不同之处在于:找最小距离要注意(l<r)? l+1:r+1的区别应用,因为可能存在左右子树为空的情况,此时值就为 ...

Sun Nov 30 01:20:00 CST 2014 0 2381
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM