<qiyuangong>946_Validate_Stack_Sequences_1.java
public boolean validateStackSequences(int[] pushed, int[] popped) {
        Stack<Integer> inStack = new Stack<>();
        int posPush = 0, posPop = 0;
        while (posPush != pushed.length) {
            int curr = pushed[posPush];
            while (!inStack.empty() && popped.length > 0 && inStack.peek() == popped[posPop]) {
                inStack.pop();
                posPop++;
            }
            if (popped.length == 0) break;
            if (curr == popped[posPop]) posPop++;
            else inStack.push(curr);
            posPush++;
        }
        while (!inStack.empty() && popped.length > 0 && inStack.peek() == popped[posPop]) {
            inStack.pop();
            posPop++;
        }
        if (inStack.empty()) return true;
        return false;
    }
public boolean var_0 ( int [ ] var_1 , int [ ] var_2 ) {
  Stack < Integer > var_5 = new Stack < > ( ) ;
  int var_7 = 0 , var_8 = 0 ;
  while ( var_7 != var_1 . length ) {
    int var_10 = var_1 [ var_7 ] ;
    while ( ! var_5 . empty ( ) && var_2 . length > 0 && var_5 . peek ( ) == var_2 [ var_8 ] ) {
      var_5 . pop ( ) ;
      var_8 ++ ;
    }
    if ( var_2 . length == 0 ) break ;
    if ( var_10 == var_2 [ var_8 ] ) var_8 ++ ;
    else var_5 . push ( var_10 ) ;
    var_7 ++ ;
  }
  while ( ! var_5 . empty ( ) && var_2 . length > 0 && var_5 . peek ( ) == var_2 [ var_8 ] ) {
    var_5 . pop ( ) ;
    var_8 ++ ;
  }
  if ( var_5 . empty ( ) ) return true ;
  return false ;
}
