<h3><a title="题目描述" href="https://leetcode-cn.com/problems/balanced-binary-tree/">题目描述</a></h3>
![file](https://i.loli.net/2019/12/25/TpfkuOvMgiKzEho.png)
<h4>我的解法</h4>
<pre class="EnlighterJSRAW" data-enlighter-language="python"># Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isBalanced(self, root: TreeNode) -> bool:
if not root:
return True
return abs(self.height(root.right)-self.height(root.left))<2 and self.isBalanced(root.left) and self.isBalanced(root.right)
# 求高度
def height(self, node):
if not node:
return 0
return 1+max(self.height(node.right),self.height(node.left))
</pre>
<p> </p>
<h4>Note:</h4>
<ul>
<li>不算熟练,加油吧。</li>
</ul>
Leetcode110 平衡二叉树