MathWorks interview question

Max difference in an array. Code using C++