human
Maximum difference between two elements in an Array | Function to return the maximum absolute difference between any two elements of the array.
To store the minimum and the maximum elements from the array.
Driver code"
Solution in Python:
 Can you provide a code to maximum difference between two elements in an Array and the other steps required?
assistant
#Here is code to maximum difference between two elements in an Array and the other steps required.
 def maxAbsDiff ( arr , n ) :
	minEle = arr [ 0 ]
	maxEle = arr [ 0 ]
	for i in range ( 1 , n ) :
		minEle = min ( minEle , arr [ i ] )
		maxEle = max ( maxEle , arr [ i ] )
	return ( maxEle - minEle )
arr = [ 2 , 1 , 5 , 3 ]
n = len ( arr )
print ( maxAbsDiff ( arr , n ) )