Leaderboard
Showing:
Large Product-2
Medium Accuracy: 0.0% Submissions: 0 Points: 4

In a town , the Chief Council of Ministers has decided to contribute funds raised from various sources in their department for the Central Public Welfare Initiatives. Given the contribution of n ministers numsi, where i represents the contribution of the ith minister, what should be the least contribution from the chief such that the nth power of his share is atleast equal to the product of contributions of all his subordinates.

Example 1:

Input: nums = {3, 2, 1, 5}
Output: 3
Explanation: 34 >= 3*2*1*5 = 30

Example 2:

Input: nums = {2}
Output: 2
Explanation: 21 >= 2

 

Your Task:
You don't need to read or print anything. Your task is to complete the function Find() which takes list nums as input parameter and returns the minimum contribution such that it's nth power is atleast equal to the product of contributions of all sunordinates of Chief.

Expected Time Complexity: O(nlog(n))
Expected Space Complexity: O(1)

 

Constraints:
1 <= n <= 10000
1 <= numsi <= 100

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.

Large Product-2

Output Window