MathWorks interview question

Dynamic programming and array manipulation questions.