```
class Solution:
# @param A, a list of integers
# @return an integer
def maxProduct(self, A):
n = [A[0]]
p = [A[0]]
for i in range(1, len(A)):
n.append(min([n[i - 1] * A[i], p[i - 1] * A[i], A[i]]))
p.append(max([n[i - 1] * A[i], p[i - 1] * A[i], A[i]]))
return max(p)
```