【LeetCode】Balanced Binary Tree 解题报告
Balanced Binary Tree
[LeetCode]
https://leetcode.com/submissions/detail/40087813/
Total Accepted: 72203 Total Submissions: 225370 Difficulty: Easy
Question
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
https://leetcode.com/submissions/detail/40087813/
Examples
–
Ways
运用递归,递归当前和 左子树和右子树的深度,当所有的左右子树的深度相差不超过1的时候,就是平衡二叉树。
Solution
托管在我的GitHub上:
https://github.com/fuxuemingzhu/BalancedTree
Captures
测试结果截图:
Reference
http://www.cnblogs.com/Antech/p/3705928.html
Date
2015/9/16 16:43:15