Domanda di colloquio di Amazon

Code question on data structures and the topic is stack.