Solution for the largest ordered difference (between a value and another value with a smaller index) in the array