Maximize Machine Strength Sum
Updated
Problem statement
You are given n machines, each with at least two power units. The power units are represented by machinePowers, where machinePowers[i] contains the power values for the i-th machine.
The strength of a machine is the minimum power among all power units currently in that machine.
You may perform the following operation any number of times:
- Select an unmarked machine.
- Transfer exactly one power unit from that machine to any other machine.
- Mark the selected machine. A marked machine cannot be selected again, but it may still receive power units.
Return the maximum possible sum of strengths of all machines after performing operations optimally.
Function
maximizeMachineStrengthSum(machinePowers: int[][]) → longExamples
Example 1
machinePowers = [[2,7,4],[2,4,3]]return = 6Move the power unit 2 from the first machine to the second. The strengths become 4 and 2.
Constraints
1 <= machinePowers.length2 <= machinePowers[i].length- The total number of power units is at most
2 * 10^5.
More Amazon Online Assessment questions
- Maximize K-Element AND with an Increment BudgetOA · Seen Nov 2026
- Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
- Top K Frequent ElementsOA · PHONE SCREEN · Seen Nov 2026
- Get Smallest Base SegmentOA · Seen Nov 2026
- Minimum Cost of Left and Right PropagationOA · Seen Nov 2026
- Minimum Grid InconvenienceOA · Seen Nov 2026
- Maximize Shipment Order by Sorting One WindowOA · Seen Nov 2026
- Maximum Equal-Bit Pairs in a SubsequenceOA · Seen Nov 2026
- First Non-Repeating CharacterOA · ONSITE INTERVIEW · Seen Nov 2026
- Two SumOA · PHONE SCREEN · Seen Nov 2026
Similar questions at other companies
- Delete and Freeze GameRubrik · OARubrik interview questions
- Most Segments That Sort the ArrayRippling · OARippling interview questions
- IPO Share AllocationTwo Sigma · OATwo Sigma interview questions
- Most Items Within Budget from a Start IndexHudson River Trading · OAHudson River Trading interview questions
- Divide Tree NodesGoogle · OA · ONSITE INTERVIEWGoogle interview questions
- Maximum Server Processing TimeArista Networks · OAArista Networks interview questions
- Minimum Satellite Data Transfer IterationsHSBC · OAHSBC interview questions
- Initial Public OfferingPoint72 · OAPoint72 interview questions
- Luna and the Colorful SocksPhonePe · OAPhonePe interview questions
- Minimum Starting Coins to Buy All ProductsMicrosoft · OAMicrosoft interview questions