Incedo Interview Question

Two puzzles were asked. Stack and Queue basic