human
Given an array arr [ ] , find the maximum j | For a given array arr [ ] , returns the maximum j a i such that arr [ j ] > arr [ i ].
driver code"
Solution in Python:
assistant
#Here is code to given an array arr [ ] , find the maximum j and the other steps required.
 def maxIndexDiff ( arr , n ) :
	maxDiff = - 1
	for i in range ( 0 , n ) :
		j = n - 1
		while ( j > i ) :
			if arr [ j ] > arr [ i ] and maxDiff < ( j - i ) :
				maxDiff = j - i
			j -= 1
	return maxDiff
arr = [ 9 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 18 , 0 ]
n = len ( arr )
maxDiff = maxIndexDiff ( arr , n )
print ( maxDiff )