Pergunta de entrevista da empresa MathWorks

Stack based interview question - from leetcode