I was practising DSA questions.
Given an array Arr[] that contains N integers (may be positive, negative or zero). Find the product of the maximum product subarray.
I am unable to complete this code. Please check the code and help. Thanks in advance.
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