Pregunta de entrevista de Walmart Global Tech

Coding question which was solved by implementing a stack data structure.