首页
题库
面试
求职
学习
竞赛
More+
所有博客
搜索面经/职位/试题/公司
搜索
我要招人
去企业版
登录 / 注册
首页
>
试题广场
>
后序遍历二叉搜索树的序列判别
[编程题]后序遍历二叉搜索树的序列判别
热度指数:55
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 256M,其他语言512M
算法知识视频讲解
输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果。如果是则返回
true
,否则返回
false
。假设输入的数组的任意两个数字都互不相同。
如下:
5 / \ 2 6 / \ 1 3
示例1
输入
[1,6,3,2,5]
输出
false
示例2
输入
[1,3,2,6,5]
输出
true
马上挑战
算法知识视频讲解
提交运行
算法知识视频讲解
添加笔记
求解答(0)
邀请回答
收藏(1)
分享
纠错
提交结果有问题?
2个回答
0篇题解
开通博客
暂无题解
问题信息
C++工程师
golang工程师
iOS工程师
安卓工程师
运维工程师
前端工程师
算法工程师
伴鱼少儿英语
测试工程师
PHP工程师
安全工程师
游戏研发工程师
2021
数据库工程师
信息技术岗
区块链
测试开发工程师
大数据开发工程师
数据分析师
Java工程师
上传者:
小小
难度:
2条回答
1收藏
2646浏览
热门推荐
通过挑战的用户
Kiboo
2022-08-17 16:26:07
廖佳庆
2022-08-12 10:03:58
菲尼克斯弗兰克
2022-07-17 12:38:06
GP_best
2022-05-25 15:45:58
风舞无痕
2022-03-22 16:38:42
相关试题
在类的定义中构造函数的作用是()
哔哩哔哩
游戏研发工程师
2020
评论
(1)
调用函数时,入参及返回地址使用了()
栈
Java工程师
C++工程师
iOS工程师
安卓工程师
算法工程师
PHP工程师
顺丰集团
2019
信息技术岗
区块链
评论
(7)
来自
顺丰科技2019秋招安卓...
下面描述中,符合结构化程序设计风格...
北京搜狐互联网信息服务有限公司
Java工程师
C++工程师
iOS工程师
安卓工程师
运维工程师
前端工程师
算法工程师
PHP工程师
2018
评论
(1)
在大语言模型中,什么是"Gated...
大模型开发
评论
(1)
关于大模型“上下文窗口”的理解,以...
大模型概念
评论
(1)
后序遍历二叉搜索树的序列判别
扫描二维码,关注牛客网
意见反馈
下载牛客APP,随时随地刷题
import java.util.*; public class Solution { /** * 后序遍历二叉搜索树 * @param postorder int整型一维数组 * @return bool布尔型 */ public boolean verifyPostorder (int[] postorder) { // write code here } }
class Solution { public: /** * 后序遍历二叉搜索树 * @param postorder int整型一维数组 * @param postorderLen int postorder数组长度 * @return bool布尔型 */ bool verifyPostorder(int* postorder, int postorderLen) { // write code here } };
# # 后序遍历二叉搜索树 # @param postorder int整型一维数组 # @return bool布尔型 # class Solution: def verifyPostorder(self , postorder ): # write code here
/** * 后序遍历二叉搜索树 * @param postorder int整型一维数组 * @return bool布尔型 */ function verifyPostorder( postorder ) { // write code here } module.exports = { verifyPostorder : verifyPostorder };
# # 后序遍历二叉搜索树 # @param postorder int整型一维数组 # @return bool布尔型 # class Solution: def verifyPostorder(self , postorder ): # write code here
package main /** * 后序遍历二叉搜索树 * @param postorder int整型一维数组 * @return bool布尔型 */ func verifyPostorder( postorder []int ) bool { // write code here }
/** * 后序遍历二叉搜索树 * @param postorder int整型一维数组 * @param postorderLen int postorder数组长度 * @return bool布尔型 */ bool verifyPostorder(int* postorder, int postorderLen ) { // write code here }
[1,6,3,2,5]
false
[1,3,2,6,5]
true