Choosing the model for solving a problem: a queue or a stack? — exercise

Did you try it yourself yet?האם כבר ניסיתם לפתור בעצמכם?

Trying first, even if it fails, lets the exercise teach you. Show the solution now?לנסות לפני צפייה בפתרון, היא דרך טובה מאד ללמוד. האם להציג את הפתרון?