mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
28 lines
775 B
HTML
28 lines
775 B
HTML
<p>给定一棵二叉树的根节点 <code>root</code>,请左右翻转这棵二叉树,并返回其根节点。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<p><img alt="" src="https://pic.leetcode.cn/1694686821-qlvjod-%E7%BF%BB%E8%BD%AC%E4%BA%8C%E5%8F%89%E6%A0%91.png" /></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [5,7,9,8,3,2,4]
|
||
<strong>输出:</strong>[5,9,7,4,2,3,8]
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li>树中节点数目范围在 <code>[0, 100]</code> 内</li>
|
||
<li><code>-100 <= Node.val <= 100</code></li>
|
||
</ul>
|
||
|
||
<p> </p>
|
||
|
||
<p>注意:本题与主站 226 题相同:<a href="https://leetcode-cn.com/problems/invert-binary-tree/">https://leetcode-cn.com/problems/invert-binary-tree/</a></p>
|
||
|
||
<p> </p>
|