human
Maximum Product Subarray | Returns the product of max product subarray ..
Initializing result.
traversing in current subarray.
updating result every time to keep an eye over the maximum product.
updating the result for ( n - 1 ) th index ..
Driver code"
Solution in Python:
assistant
#Here is code to maximum Product Subarray and the other steps required.
 def maxSubarrayProduct ( arr , n ) :
	result = arr [ 0 ]
	for i in range ( n ) :
		mul = arr [ i ]
		for j in range ( i + 1 , n ) :
			result = max ( result , mul )
			mul *= arr [ j ]
		result = max ( result , mul )
	return result
arr = [ 1 , - 2 , - 3 , 0 , 7 , - 8 , - 2 ]
n = len ( arr )
print ( " Maximum ▁ Sub ▁ array ▁ product ▁ is " , maxSubarrayProduct ( arr , n ) )