 # Consider an array,find the maximum difference a[j] - a[i] if i < j

#1

Consider an array,find the maximum difference a[j] - a[i] if i < j

#2

For finding maximum diff in an array we have to find the largest and smallest number of its.
The following code from “geeks for geeks” will be pretty helpful in understanding the concept.
We can implement it in an array likewise. Here is the link:

#3

I think for finding the maximum diffrence of the array elements we have to know what are the elements which are present in the array. If we dont know the array elements then it is impossible to find the diffrence of any two array elements. As here mentioned a[j] - a[i] where i < j but here it is not mentioned if the array is sorted or not and what are the elements present in the array so it is impossible. and more over Maybe i < j And we are finding the diffrence between two array elements where I and j are the array index only . So here from the above question we can not answer what is the maximum diffrence between two array elements as mentioned above.