数组中的动态规划
class Solution:
def maxProduct(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
_max=_min=res=nums[0]
for i in range(1,len(nums)):
cur1=nums[i]*_max
cur2=nums[i]*_min
_max=max(cur1,cur2,nums[i])
_min=min(cur1,cur2,nums[i])
res=max(_max,res)
return res