Queue with two stacks Python 3

preview_player
Показать описание
In this video, we'll implement a queue where operations enqueue and dequeue can be performed. However, it has to implemented using two stacks.
Рекомендации по теме
Комментарии
Автор

Thank you this is very helpful. You do nice work.

davege
Автор

In this code there is a one problem .. Suppose
I Add 2number 4, 5 after append .. i delet 1 time .. 4 is delete .. then 5 is remaining .. and I append one time 6 .. then if want to remove .. 6 is removed .. so that's is not correct .. because 5 append before 6 .. remove number should be 5 .

shankhadeepghosh
Автор

Remove should first check if there is an element to remove in stack 2 before appending stack 1 to stack 2

Maxxqc