1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/平衡二叉树 [ping-heng-er-cha-shu-lcof].html
2022-03-29 12:43:11 +08:00

45 lines
910 B
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>输入一棵二叉树的根节点判断该树是不是平衡二叉树。如果某二叉树中任意节点的左右子树的深度相差不超过1那么它就是一棵平衡二叉树。</p>
<p> </p>
<p><strong>示例 1:</strong></p>
<p>给定二叉树 <code>[3,9,20,null,null,15,7]</code></p>
<pre>
3
/ \
9 20
/ \
15 7</pre>
<p>返回 <code>true</code><br />
<br />
<strong>示例 2:</strong></p>
<p>给定二叉树 <code>[1,2,2,3,3,null,null,4,4]</code></p>
<pre>
1
/ \
2 2
/ \
3 3
/ \
4 4
</pre>
<p>返回 <code>false</code></p>
<p> </p>
<p><strong>限制:</strong></p>
<ul>
<li><code>0 <= 树的结点个数 <= 10000</code></li>
</ul>
<p>注意:本题与主站 110 题相同<a href="https://leetcode-cn.com/problems/balanced-binary-tree/">https://leetcode-cn.com/problems/balanced-binary-tree/</a></p>
<p> </p>