152. 乘积最大子数组

同时维护最大和最小乘积。

难度:中等。题型:DP。

标签:数组、动态规划、高频面试

双状态 DP:curMax = max(x, curMax*x, curMin*x)。 时间复杂度 O(n),空间复杂度 O(1)。