P15342 [GeeksforGeeks] Minimum product pair3608
普及-
题目描述

Given an array of positive integers. The task is to print the minimum product of any two numbers of the given array.

Example 1:
Input : n = 4 arr[] = {2, 7, 3, 4}
Output : 6
Explanation : The minimum product of any two numbers
will be 2 * 3 = 6.

Example 2:
Input : n = 6 arr[] = {198, 76, 544, 123, 154, 675}
Output : 9348
Explanation : The minimum product of any two numbers
will be 76 * 123 = 9348.

Your Task:
You don't need to read input or print anything. Your task is to complete the functionprintMinimumProduct()which takes the array A[] and its size N as inputs and returns the minimum product of two numbers

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Constraints:
2<=N<=10^{5}
1<=A[i]<=10^{5}

输入格式

见题面

输出格式

见题面

样例输入
n = 4 arr[] = {2, 7, 3, 4}
样例输出
6