双栈

import java.util.*;
import java.util.ArrayList;
public class Solution {
    public boolean IsPopOrder(int [] pushA,int [] popA) {
      Stack A = new Stack();
      Stack B = new Stack();
      for(int i = popA.length-1;i>=0;i--){
          B.push(popA[i]);
      }

      for(int i:pushA){
          A.push(i);
          while((!A.isEmpty() && !B.isEmpty())&&(A.peek().compareTo(B.peek())==0)){
              A.pop();
              B.pop();
          }
      }
      if(B.isEmpty()){
          return true;
      }else{
          return false;
      }
    }
}