Minimum value product
Easy Accuracy: 31.18% Submissions: 263 Points: 2

Given an array of n elements, update all elements of given array to some minimum value x i.e, arr[i] = x (0 <= i < n), such that product of all elements of this new array is strictly greater than the product of all elements of the initial array.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. The next line contains the space separated array elements.

Output:
Print the minimum value for the new array such that product of elements of this new array is strictly greater than the product of all elements of the initial array.

Constraints:
1 <= T <= 105
1 <= arr[i] <= 1010
1 <= n <= 105

Example:
Input:

2
5
4 2 1 10 6
5
100 150 10000 123458 90980454

Output:
4
17592

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.