class Solution:
def maxProduct(self, A):
product = [0] * (len(A)+1)
max_prod = None
for i in range(len(A)):
product[i] = max(product[i1]*A[i], A[i])
if product[i] > max_prod:
max_prod = product[i]
return max_prod
Python DP solution. Internal error on submission. Any clues ?. I am successfully able to run in my mc

The internal error disappeared but the solution i created below doesnt seem to work.
class Solution: # @param A, a list of integers # @return an integer def maxProduct(self, A): product = [0] * (len(A)+1) max_prod = None for i in range(len(A)): product[i+1] = max(product[i]*A[i], A[i]) if product[i] != 0 else A[i] if product[i+1] > max_prod: max_prod = product[i+1] return max_prod
For this input [2,3,4]. Looks like some other changes are needed.