Geeksforgeeks

Error

×

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 | |

Handle | Score |

@anish5256 | 991 |

@vimleshpratapsingh321 | 980 |

@skj7 | 871 |

@akhileshkumar562002 | 862 |

@pradeeppatidar1999 | 840 |

@kanewilliamson123 | 837 |

@pd420786 | 813 |

@infilooop | 800 |

@bunnybug320 | 796 |

@smitabose7826 | 784 |

@virgat | 768 |

Complete Leaderboard |

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)*

**Expected Time Complexity:** O(nlogn).

**Expected Auxiliary Space:** O(1).

**Constraints:**

1 ≤ K, N ≤ 10^{5}

Login 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?

YesLoading...

Minimum Product of k Integers

...