Infosys interview question

DSA question about Stacks and queues