Preorder Traversal

查看题解 查看答案
题目描述
Time Limit: 1000 ms
Memory Limit: 256 mb

请先登录再刷题,不会做的题目右上可以查看题解和答案~

输入输出格式
输入描述:
Each input file contains one test case. For each case, the first line gives a positive integer N (≤ 50,000), the total number of nodes in the binary tree. The second line gives the postorder sequence and the third line gives the inorder sequence. All the numbers in a line are separated by a space.
输出描述:
For each test case, print in one line the last number of the preorder traversal sequence of the corresponding binary tree.
输入输出样例
输入样例#:
7
1 2 3 4 5 6 7
2 1 4 3 7 5 6
输出样例#:
复制
5
题目来源
浙江大学2021年机试题
重置

提交代码后在此处可查看状态