【LeetCode】152. 乘积最大子数组(DP)
2021-01-18 10:15
                         标签:连续子数组   最小   etc   code   最小值   ima   solution   返回   个数    给你一个整数数组 nums ,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。 示例 1: 示例 2: 代码: 【LeetCode】152. 乘积最大子数组(DP) 标签:连续子数组   最小   etc   code   最小值   ima   solution   返回   个数    原文地址:https://www.cnblogs.com/whisperbb/p/12913956.html输入: [2,3,-2,4]
输出: 6
解释: 子数组 [2,3] 有最大乘积 6。
输入: [-2,0,-1]
输出: 0
解释: 结果不能为 2, 因为 [-2,-1] 不是子数组。
class Solution {
    public int maxProduct(int[] nums) {
        int max = Integer.MIN_VALUE, imax = 1, imin = 1;
        for(int i = 0; i 
文章标题:【LeetCode】152. 乘积最大子数组(DP)
文章链接:http://soscw.com/index.php/essay/43627.html