Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the largest product = 6.
本文介绍了一种求解最大连续子数组乘积的方法。针对包含至少一个数字的数组,寻找具有最大乘积的连续子数组。通过动态规划记录每个位置上的最大正数和最小负数乘积,以应对负数带来的符号变化。
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the largest product = 6.

被折叠的 条评论
为什么被折叠?