solution.md 1.3 KB
Newer Older
1
# 平衡二叉树
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<p>给定一个二叉树,判断它是否是高度平衡的二叉树。</p>

<p>本题中,一棵高度平衡二叉树定义为:</p>

<blockquote>
<p>一个二叉树<em>每个节点 </em>的左右两个子树的高度差的绝对值不超过 1 。</p>
</blockquote>

<p> </p>

<p><strong>示例 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/06/balance_1.jpg" style="width: 342px; height: 221px;" />
<pre>
<strong>输入:</strong>root = [3,9,20,null,null,15,7]
<strong>输出:</strong>true
</pre>

<p><strong>示例 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2020/10/06/balance_2.jpg" style="width: 452px; height: 301px;" />
<pre>
<strong>输入:</strong>root = [1,2,2,3,3,null,null,4,4]
<strong>输出:</strong>false
</pre>

<p><strong>示例 3:</strong></p>

<pre>
<strong>输入:</strong>root = []
<strong>输出:</strong>true
</pre>

<p> </p>

<p><strong>提示:</strong></p>

<ul>
	<li>树中的节点数在范围 <code>[0, 5000]</code></li>
	<li><code>-10<sup>4</sup> <= Node.val <= 10<sup>4</sup></code></li>
</ul>

<p>以下错误的选项是?</p>
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
## aop
### before
```cpp

```
### after
```cpp

```

## 答案
```cpp

```
## 选项

### A
```cpp

```

### B
```cpp

```

### C
```cpp

```