Pergunta de entrevista da empresa Netflix

How to implement a queue using stack? ( not this question, but this type of questions and the question many be more difficult than this.)

Resposta da entrevista

Sigiloso

3 de ago. de 2022

Push() values onto one stack. Pop() all values and reverse the order by pushing onto another stack. Now you have a stack that can pop() the very first value, followed by the rest of the values in order.

2