mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
33 lines
865 B
HTML
33 lines
865 B
HTML
<p>请完成一个函数,输入一个二叉树,该函数输出它的镜像。</p>
|
||
|
||
<p>例如输入:</p>
|
||
|
||
<p><code> 4<br>
|
||
/ \<br>
|
||
2 7<br>
|
||
/ \ / \<br>
|
||
1 3 6 9</code><br>
|
||
镜像输出:</p>
|
||
|
||
<p><code> 4<br>
|
||
/ \<br>
|
||
7 2<br>
|
||
/ \ / \<br>
|
||
9 6 3 1</code></p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre><strong>输入:</strong>root = [4,2,7,1,3,6,9]
|
||
<strong>输出:</strong>[4,7,2,9,6,3,1]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>限制:</strong></p>
|
||
|
||
<p><code>0 <= 节点个数 <= 1000</code></p>
|
||
|
||
<p>注意:本题与主站 226 题相同:<a href="https://leetcode-cn.com/problems/invert-binary-tree/">https://leetcode-cn.com/problems/invert-binary-tree/</a></p>
|