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)/二叉搜索树的后序遍历序列 [er-cha-sou-suo-shu-de-hou-xu-bian-li-xu-lie-lcof].html
2022-03-29 12:43:11 +08:00

30 lines
695 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>