1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 02:58:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/二叉搜索树的后序遍历序列 [er-cha-sou-suo-shu-de-hou-xu-bian-li-xu-lie-lcof].html

30 lines
695 B
HTML
Raw Normal View History

2022-03-27 20:38:29 +08:00
<p>输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回&nbsp;<code>true</code>,否则返回&nbsp;<code>false</code>。假设输入的数组的任意两个数字都互不相同。</p>
<p>&nbsp;</p>
<p>参考以下这颗二叉搜索树:</p>
<pre> 5
/ \
2 6
/ \
1 3</pre>
<p><strong>示例 1</strong></p>
<pre><strong>输入: </strong>[1,6,3,2,5]
<strong>输出: </strong>false</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入: </strong>[1,3,2,6,5]
<strong>输出: </strong>true</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>数组长度 &lt;= 1000</code></li>
</ol>