Pregunta de entrevista de MathWorks

Max difference in an array. Code using C++