Question d’entretien chez Fivestars

Implement a queue with two stacks (enqueue, dequeue, peek)

Réponse à la question d'entretien

Utilisateur anonyme

9 sept. 2016

To enqueue, pop all of stack B onto onto stack A, push onto stack A. To dequeue, pop all of stack A onto stack B, then pop stack B. To peek, pop all of stack A onto stack B, then peek stack B.