Minimum Product of k Integers
Basic Accuracy: 24.99% Submissions: 1688 Points: 1

Given an array of N positive integers. You need to write a program to print the minimum product of k integers of the given array.

Note: Since output could be large, hence module 10^9+7 and then print answer.

Example 1:

Input : Arr[] = {1, 2, 3, 4, 5}, K = 2
Output : 2
If we have an array [1, 2, 3, 4, 5]. 
We will get the minimum product after multiplying
1 and 2 that is 2.
So, the answer is 2.

Example 2:

Input : Arr[] = {9, 10, 8}, K = 3
Output : 720


Your Task:
This is a function problem. The input is already taken care of by the driver code. You only need to complete the function minProduct() that takes an array (arr), sizeOfArray (n), element K, and return the minimum product. The driver code takes care of the printing.

Expected Time Complexity: O(nlogn).
Expected Auxiliary Space: O(1).

1 ≤ K, N ≤ 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.


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


All Submissions

My Submissions:

Login to access your submissions.

Minimum Product of k Integers

Output Window