https://www.nowcoder.com/practice/d77d11405cc7470d82554cb392585106
辅助栈

public boolean IsPopOrder(int[] pushA, int[] popA) {int n = pushA.length;//辅助栈Stack<Integer> s = new Stack<>();//遍历入栈的下标int i = 0;//遍历出栈的数组for (int j = 0; j < n; j++) {//入栈:栈为空或者栈顶不等于出栈数组while (i < n && (s.isEmpty() || s.peek() != popA[j])) {s.push(pushA[i]);i++;}//栈顶等于出栈数组if (s.peek() == popA[j]) {s.pop();} else {//不匹配序列return false;}}return true;}
