Problem
Maximize Minimum Machine Power
Learn this problemProblem statement
You are given an integer array sources, where sources[i] is the amount of power available from the i-th power source, and an integer n representing the number of machines.
Each machine must receive power from exactly one source. A source may power multiple machines, but the total power assigned from that source cannot exceed its capacity.
Return the maximum possible value of the minimum power assigned to any machine.
Function
maximizeMinimumMachinePower(sources: int[], n: int) → intExamples
Example 1
sources = [5, 8, 6]n = 4return = 4A minimum assignment of 4 is possible: the sources can support 1 + 2 + 1 = 4 machines with at least 4 power each. A minimum of 5 would support only 1 + 1 + 1 = 3 machines.
Example 2
sources = [10, 10]n = 3return = 5Each source can power two machines with 5 power each, so three machines can be powered. A minimum of 6 would allow only two machines total.
Constraints
1 <= sources.length1 <= nsources[i]is a non-negative integer power capacity.
More Amazon problems
- HTTP Request RedirectionOA · Seen Jul 2026
- Merge IntervalsOA · Seen Jul 2026
- Permutation SorterOA · Seen Jul 2026
- Resolve Task DependenciesONSITE INTERVIEW · Seen Jul 2026
- Shortest Distance on a Circular Bus RouteOA · Seen Jul 2026
- Longest Increasing Subsequence With Bounded Adjacent DifferenceONSITE INTERVIEW · Seen Jul 2026
- Search in a Rotated Sorted ArrayONSITE INTERVIEW · Seen Jul 2026
- Sliding Window MaximumONSITE INTERVIEW · Seen Jul 2026