#3814

Maximum Capacity Within Budget

expert · 1190 · lc medium +32 · 20% accepted · 184 likes · top 1%

Description

Given integer arrays costs and capacity of length n and an integer budget, where costs[i] is the price and capacity[i] is the output of machine i, pick at most two distinct machines whose combined cost is strictly less than budget. Return the highest total capacity you can achieve.

Code

1
2
3