mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-30 07:33:45 +00:00
Update 33. 二叉搜索树的后序遍历序列.md
题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 33. 二叉搜索树的后序遍历序列
|
||||
|
||||
[NowCoder](https://www.nowcoder.com/practice/a861533d45854474ac791d90e447bafd?tpId=13&tqId=11176&tPage=1&rp=1&ru=/ta/coding-interviews&qru=/ta/coding-interviews/question-ranking&from=cyc_github)
|
||||
[Leetcode](https://leetcode.cn/problems/er-cha-sou-suo-shu-de-hou-xu-bian-li-xu-lie-lcof/)
|
||||
|
||||
## 题目描述
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
## 解题思路
|
||||
|
||||
```java
|
||||
public boolean VerifySquenceOfBST(int[] sequence) {
|
||||
if (sequence == null || sequence.length == 0)
|
||||
return false;
|
||||
return verify(sequence, 0, sequence.length - 1);
|
||||
public boolean verifyTreeOrder(int[] postorder) {
|
||||
if (postorder == null || postorder.length == 0)
|
||||
return true;
|
||||
return verify(postorder, 0, postorder.length - 1);
|
||||
}
|
||||
|
||||
private boolean verify(int[] sequence, int first, int last) {
|
||||
|
||||
Reference in New Issue
Block a user