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.
解法:DP with O(N) time and O(1) space
由于有负数的存在,有可能负负得正的情况出现,所以需要维护当前的最大值和最小值。最大值是max(A[i], min A[i], max A[i])
同时对每一个新元素要update最大值和最小值。