Find the Maximum Product of Two Elements
Easyjavapythonccppjavascript
Given an array of N integers, find the maximum product obtainable by multiplying values at two different positions.
Input Format
The first line contains an integer N. The second line contains N space-separated integers.
Output Format
Print the maximum product of any two elements at different positions.
Example 1
Input
4 -10 -3 5 6
Output
30
Explanation: The maximum product is 5 * 6 = 30.
- 2 <= N <= 100000
- -100000 <= A[i] <= 100000