import java.util.ArrayList;
import java.util.Stack;
public class Solution {
public boolean IsPopOrder(int [] pushA,int [] popA) {
Stack<Integer> stack=new Stack<Integer>();
int temp=0;//popA的指针
for(int i=0;i<pushA.length;i++){//遍历pushA
stack.push(pushA[i]);
while(!stack.isEmpty()&&stack.peek()==popA[temp]){//栈非空且 栈顶元素等于popA中当前temp指向的数
stack.pop();//出栈
temp++;//popA指针右移
}
}
return stack.isEmpty();
}
}