BETA

Submissions : 630 Accuracy :

7.78

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 Examples Use Expected Output**


Contributor: Saksham Raj Seth

Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



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