mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
32 lines
1.0 KiB
HTML
32 lines
1.0 KiB
HTML
<p>请设计一个函数判断一棵二叉树是否 <strong>轴对称</strong> 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<p><img alt="" src="https://pic.leetcode.cn/1694689008-JaaRdV-%E8%BD%B4%E5%AF%B9%E7%A7%B0%E4%BA%8C%E5%8F%89%E6%A0%911.png" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [6,7,7,8,9,9,8]
|
||
<strong>输出:</strong>true
|
||
<strong>解释:</strong>从图中可看出树是轴对称的。</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<p><img alt="" src="https://pic.leetcode.cn/1694689054-vENzHe-%E8%BD%B4%E5%AF%B9%E7%A7%B0%E4%BA%8C%E5%8F%89%E6%A0%912.png" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [1,2,2,null,3,null,3]
|
||
<strong>输出:</strong>false
|
||
<strong>解释:</strong>从图中可看出最后一层的节点不对称。</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<p><code>0 <= 节点个数 <= 1000</code></p>
|
||
|
||
<p>注意:本题与主站 101 题相同:<a href="https://leetcode-cn.com/problems/symmetric-tree/">https://leetcode-cn.com/problems/symmetric-tree/</a></p>
|
||
|
||
<p> </p>
|