Pergunta de entrevista da empresa MathWorks

MATLAB coding, involves syntax and index problem