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)/从上到下打印二叉树 III [cong-shang-dao-xia-da-yin-er-cha-shu-iii-lcof].html
2022-03-29 12:43:11 +08:00

31 lines
572 B
HTML

<p>请实现一个函数按照之字形顺序打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右到左的顺序打印,第三行再按照从左到右的顺序打印,其他行以此类推。</p>
<p>&nbsp;</p>
<p>例如:<br>
给定二叉树:&nbsp;<code>[3,9,20,null,null,15,7]</code>,</p>
<pre> 3
/ \
9 20
/ \
15 7
</pre>
<p>返回其层次遍历结果:</p>
<pre>[
[3],
[20,9],
[15,7]
]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>节点总数 &lt;= 1000</code></li>
</ol>