1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-02-04 14:40:27 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/检查平衡性 [check-balance-lcci].html

25 lines
473 B
HTML
Raw Normal View History

2025-01-09 20:29:41 +08:00
<p>实现一个函数,检查二叉树是否平衡。在这个问题中,平衡树的定义如下:任意一个节点,其两棵子树的高度差不超过 1。</p>
<br />
<strong>示例 1</strong>
<pre>
给定二叉树 [3,9,20,null,null,15,7]
3
/ \
9 20
/ \
15 7
返回 true 。</pre>
<strong>示例 2</strong>
<pre>
给定二叉树 [1,2,2,3,3,null,null,4,4]
1
/ \
2 2
/ \
3 3
/ \
4 4
返回&nbsp;false 。</pre>