Pergunta de entrevista da empresa Accenture

How to reverse a stack and write working code?