class Solution:
"""
@param nums: An array of integers
@return: An integer
"""
def maxProduct(self, nums):
# write your code here
#
maxc = nums[0]
minc = nums[0]
resultc = nums[0]
for i in range(1,len(nums)):
tmpmaxc = maxc
tmpminc = minc
# 记录最大值和最小值,更新最大值和最小值
maxc = max(nums[i],nums[i]*tmpmaxc,nums[i]*tmpminc)
minc = min(nums[i],nums[i]*tmpmaxc,nums[i]*tmpminc)
resultc = max(maxc,minc,resultc)
return resultc