亚马逊在线笔试题目
Question 2 / 2
Question:
As you know, two operations of Stack are push and pop. Now give you two integer arrays, one is the original array before
push and pop operations, the other one is the result array after a series of push and pop operations to the first array. Please
give the push and pop operation sequence.
For example:
If the original array is a[] = {1,2,3}, and the result array is b[] = {1,3,2}.
Then, the operation sequence is “push1|pop1|push2|push3|pop3|pop2”(operations are split by ‘|’ and no space).
Rules:
1. The push and pop operations deal with the original int array from left to right.
2. The input is two integer array. They are the original array and the result array. These interger array is split by space.
3. The output is the operation sequence.
4. If the original array cannot make to the result arra