Pergunta de entrevista da empresa Meta

Leet code medium question using stacks. (Both questions)