Given an array A of integers, find a contiguous non-empty subarray within the array that has the largest product, and return the product.
Note: The product fits in a 32-bit integer.
A: [-1, 3, 2, -1, -2, 3, 0, -2]
Result: 36
Explanation: The subarray [3, 2, -1, -2, 3] has a product of 36.
The first line contains an integer âTâ denoting the number of test cases.
For each test case, the input has two lines:
For each test case, the output contains a line with one integer denoting the maximum product possible.
4
8
-1 3 2 -1 -2 3 0 -2
7
3 0 -1 -2 3 0 -2
9
1 2 3 4 5 0 0 -1 1
1
-2
36
6
120
-2
1 <= T <= 10
1 <= n <= 105
-109 <= Ai <= 109