Maximum Product Subarray
Find the maximum product of any non-empty contiguous subarray.
Input: the first line has N; the second line has N integers.
Output: the maximum subarray product.
Constraints:
- 1 ≤ N ≤ 3000
- |ai| ≤ 10
Sample Tests
Input 1
4 2 -3 -2 4
Output 1
48
Input 2
3 -2 0 -1
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.