Maximize Minimum Machine Power
Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The mistake that sinks a first attempt at this Amazon OA, reported in April 2026, is trying to assign power machine by machine instead of asking what minimum is feasible. "Maximize Minimum Machine Power" gives you source capacities and a machine count n, and wants the largest value X where every machine gets at least X. It's a binary search on the answer with a simple feasibility count. If you recognize that shape in the first two minutes, the rest is twenty lines. If you blank, StealthCoder runs invisibly during the live OA as a safety net and hands you the structure.
The problem
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) → int Examples Example 1 sources = [5, 8, 6] n = 4 return = 4 A 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 = 3 return = 5 Each 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.length 1 <= n sources[i] is a non-negative integer power capacity.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick: guess a minimum power X, then count how many machines the sources can support. Each source supports floor(source / X) machines. Sum those. If the total is at least n, X is feasible. Feasibility is monotonic, since a smaller X never supports fewer machines, so binary search the largest feasible X. Search from 1 to max(sources), or to sum(sources) / n as a tighter bound. Check Example 1: X=4 gives 1+2+1=4 machines, X=5 gives 1+1+1=3. The pitfall is splitting a source's power across machines unevenly or summing total power and dividing by n. That ignores the floor per source and overshoots. Another pitfall is an infinite loop from bad mid rounding, so use the upper-mid when moving low up. Also handle zero capacities and the case where no X works. StealthCoder is your hedge if the binary search template slips under pressure in the live OA.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Maximize Minimum Machine Power cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Amazon's OA.
Amazon reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximize Minimum Machine Power FAQ
What's the trick to Maximize Minimum Machine Power?+
Binary search on the answer. Pick a candidate minimum X, compute the sum of floor(source / X) across all sources, and check if it's at least n. Feasibility is monotonic in X, so you find the largest X that passes. No greedy assignment needed.
Why not just divide total power by n?+
Because each source's leftover is wasted. A source with 5 power and X=4 supports one machine, not 1.25. In Example 1, total power is 19 and 19/4 is 4.75, but the real answer is 4 and a minimum of 5 fails. The floor per source is the whole point.
What are the search bounds?+
Low is 1, high is max(sources), or sum(sources) divided by n if you want it tighter. A single machine can never get more than the biggest source's capacity. Watch the mid calculation so the loop terminates when you move low up.
How hard is this one really?+
Medium. The code is short, but you need to see the binary-search-on-answer framing fast. If you've done problems like splitting arrays or capacity shipping, it's familiar. The failure mode is overthinking assignment instead of counting capacity.
How do I prepare for this in 48 hours?+
Write the feasibility function and the binary search loop from scratch twice. Then run both examples by hand: [5,8,6] with n=4 gives 4, and [10,10] with n=3 gives 5. Also test edge cases like n larger than any possible split and sources containing zeros.