MathWorks Interview Question

Oops, optimization and c++ related