Pergunta de entrevista da empresa MathWorks

algorithm problem with deque method