Given an array of integers, find the maximum difference between two elements in the array such that the index of smaller element is also smaller than the index of the larger element. Return the difference.
arr equal to
[ 2, 7, 9, 5, 1, 3, 5 ]. The maximum difference is between the pair
9. However the index of
1 is bigger than the index of
9, thus the biggest difference is between
9. The solution should return