mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
38 lines
906 B
HTML
38 lines
906 B
HTML
<p>给你一棵二叉树的根节点 <code>root</code> ,返回其节点值的 <strong>后序遍历 </strong>。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
<img alt="" src="https://assets.leetcode.com/uploads/2020/08/28/pre1.jpg" style="width: 127px; height: 200px;" />
|
||
<pre>
|
||
<strong>输入:</strong>root = [1,null,2,3]
|
||
<strong>输出:</strong>[3,2,1]
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = []
|
||
<strong>输出:</strong>[]
|
||
</pre>
|
||
|
||
<p><strong>示例 3:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>root = [1]
|
||
<strong>输出:</strong>[1]
|
||
</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><strong>进阶:</strong>递归算法很简单,你可以通过迭代算法完成吗?</p>
|