MathWorks Interview Question

Max difference in an array. Code using C++