find the difference between maximum and minimum element such that the maximum element is always at higher index than the smaller element
Answers
Answered by
0
Input : arr = {2, 3, 10, 6, 4, 8, 1}
Output : 8
Explanation : The maximum difference is between 10 and 2.
Input : arr = {7, 9, 5, 6, 3, 2}
Output : 2
Explanation : The maximum difference is between 9 and 7.
Similar questions