DP LeetCode152. 乘积最大子数组(Python)
1、题目描述 给你一个整数数组 nums ,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字)。 2、代码详解 法一:可扩展性好(推荐) 二维数组,2*2大小,一维存最大值,一维存负最大值 class Solution(object): def maxProduct(self, nums): """ :type nums: List[int] :rtype: int """ if nums is None: return 0 dp = [[0 for
下载地址
用户评论