X

DAYS

:

HOUR

:

MINS

:

SEC

Copied to Clipboard
Minimum product pair
Basic Accuracy: 47.45% Submissions: 1262 Points: 1

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 = 4arr[] = {2, 7, 3, 4}Output :6Explanation : The minimum product of anytwo numbers will be 2 * 3 = 25.

Example 2:

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

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<=105
1<=A[i]<=105

We are replacing the old Disqus forum with the new Discussions section given below.
Click here to view old Disqus comments.


to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.

Minimum product pair

Output Window