Goldman Sachs Interview Question

Queue and stacks related question