#K62887. Maximum Product Bitwise
Maximum Product Bitwise
Maximum Product Bitwise
Given an array of integers, your task is to find the maximum product of any two distinct elements in the array. Although the problem statement mentions 'bitwise operations', the solution involves selecting the two largest numbers in the list and computing their product using standard multiplication. Formally, if the two largest numbers in the array are \(a\) and \(b\), then the answer is \(a \times b\).
Input and Output: The input begins with an integer representing the number of test cases. For each test case, the first number is \(n\), the number of elements in the array, followed by \(n\) space-separated integers. For each test case, output the maximum product, with each result printed on a new line.
inputFormat
The first line contains an integer \(T\) representing the number of test cases. Each test case starts with an integer \(n\) (the number of elements in the array), followed by \(n\) space-separated integers.
Example:
2
5
4 7 2 8 1
3
3 6 9
outputFormat
For each test case, output a single line containing the maximum product of two distinct elements in the array.
Example Output:
56
54
2
5
4 7 2 8 1
3
3 6 9
56
54
</p>