Given an array A of N elements. The task is to find the greatest number S such that it is product of two elements of given array (S cannot be included in pair. Also, pair must be from different indices).
The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each test case contains an integer N denoting size of the array. Then in the next line are n space separated values of the array.
For each test case in a new line print the required output.
1 <= T <= 100
1 <= N <= 106
1 <= Ai <= 107
2 5 7 8
10 2 2 4 30 35
Testcase 2: 4 is the greatest element whose pair product (2, 2) is also present in array.
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.