BETA

Difficulty Level:

Basic

Total Submissions: 939 Accuracy:

8.31%

Maximum product
     

Given an array A[] of n integers, the task is to find a subsequence of size k whose product is maximum among all possible k sized subsequences of given array.

Input:
First line consists of T test cases. First line of every test cases consists of N, denoting the number of elements in an array. Second line consists of elements of array.

Output:
Single line output, print the maximum possible product.

Constraints:
1<=T<=100
1<=N<=10000
1<=K<=N
1<=Ai<=1000

Example:
Input:

2
4 3
8 6 4 6 
7 3
10 2 3 8 1 10 4 
Output:
288
800

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

Contributor: Saksham Raj Seth

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.