human
Count indices where the maximum in the prefix array is less than that in the suffix array | Function to print the count of indices in which the maximum in prefix arrays is less than that in the suffix array.
If size of array is 1.
pre [ ] : Prefix array suf [ ] : Suffix array.
Stores the required count.
Find the maximum in prefix array.
Find the maximum in suffix array.
Traverse the array.
If maximum in prefix array is less than maximum in the suffix array.
Print the answer.
Driver Code.
Function Call"
How can the above be solved in Python?

Can you provide a code to count indices where the maximum in the prefix array is less than that in the suffix array and the other steps required?
assistant
#Here is code to count indices where the maximum in the prefix array is less than that in the suffix array and the other steps required.
 def count ( a , n ) :
	if ( n == 1 ) :
		print ( 0 )
		return
	pre = [ 0 ] * ( n - 1 )
	suf = [ 0 ] * ( n - 1 )
	max = a [ 0 ]
	ans = 0
	pre [ 0 ] = a [ 0 ]
	for i in range ( n - 1 ) :
		if ( a [ i ] > max ) :
			max = a [ i ]
		pre [ i ] = max
	max = a [ n - 1 ]
	suf [ n - 2 ] = a [ n - 1 ]
	for i in range ( n - 2 , 0 , - 1 ) :
		if ( a [ i ] > max ) :
			max = a [ i ]
		suf [ i - 1 ] = max
	for i in range ( n - 1 ) :
		if ( pre [ i ] < suf [ i ] ) :
			ans += 1
	print ( ans )
arr = [ 2 , 3 , 4 , 8 , 1 , 4 ]
N = len ( arr )
count ( arr , N )