Leaderboard
Showing:
Handle Score
@Ibrahim Nash 6560
@blackshadows 6400
@mb1973 5777
@Quandray 5271
@akhayrutdinov 5111
@saiujwal13083 5074
@kirtidee18 4356
@sanjay05 3762
@mantu_singh 3638
@gfgaccount 3601
@marius_valentin_dragoi 3525
Complete Leaderboard
Minimum Product of k Integers
Basic Accuracy: 24.39% Submissions: 1326 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
Explanation:
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).


Constraints:
1 ≤ K, N ≤ 105

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 of k Integers

Output Window