Pergunta de entrevista da empresa Amazon

Solve a coding question based on Stacks