The hiring team of Google aims to find 3 candidates who are great collectively. Each candidate has his or her ability expressed as an integer. 3 candidates are great collectively if product of their abilities is maximum. Given abilities of N candidates, find the maximum collective ability from the given pool of candidates.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follows. First line of each test case conatins an interger N denoting the number of candidates.
The second line of each test case contains N space separated elements denoting the ablities of candidates.
Corresponding to each test case, print the desired output(maximum collective ability of three candidates) in a newline.
1 ≤ T ≤ 100
3 ≤ N ≤ 107
-105 ≤ ability ≤ 105
0 -1 3 100 70 50
Testcase 1: 70*50*100 = 350000 which is the maximum possible.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.