Domanda di colloquio di Incedo

Two puzzles were asked. Stack and Queue basic