BETA

Difficulty Level: Easy

Total Submissions: 100 Accuracy:

37%

Minimum value product
       

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<=10^5
1<=arr[i]<=10^10
1<=n<=10^5

Example:
Input:

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

Output:
4
17592

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.