Pergunta de entrevista da empresa Freshtohome

Simple leetcode easy question related to stacks.