Pergunta de entrevista da empresa Amazon

Code question on data structures and the topic is stack.