Pregunta de entrevista de MathWorks

Walk me through ur thought process for this problem