MathWorks interview question

DP question pretty easy one