```
class Solution:
# @param A, a list of integers
# @return an integer
def maxProduct(self, A):
if not A:
return 0
elif len(A)==1:
return A[0]
# need max and min together
maxnum=A[0]
minnum=A[0]
resultmax=maxnum
for i in range(1,len(A)):
if A[i]>0:
maxnum=max(A[i],A[i]*maxnum)
minnum=min(A[i],A[i]*minnum)
else:
oldmax=maxnum
maxnum=max(A[i],A[i]*minnum)
minnum=min(A[i],A[i]*oldmax)
resultmax=max(resultmax,maxnum)
return resultmax
```

this has been simplified from a full DP with arrays storing max and min ending at each i