摘要: class Solution { public: bool isBalanced(TreeNode* root) { int depth = 0; return Balanced(root,depth); } bool Balanced(TreeNode* root,int& depth){ if(root == NUL... 阅读全文
posted @ 2019-04-07 15:55 有梦就要去实现他 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 104: 111: 最小的深度这个题与最大的深度这个题稍稍有点不同,因为最小深度的计算必须从叶子节点开始,没有叶子节点不能计算,所以1,2这种情况只能返回2,不能返回1。做个判断即可。 阅读全文
posted @ 2019-04-07 15:42 有梦就要去实现他 阅读(125) 评论(0) 推荐(0) 编辑