Minimum Cost to Reach Target Server Power

Asked at Amazon · Coding Questions · Difficulty: Hard

Given `power` and `price` (each price is 1 or 2), choose a subset of machines whose total power is at least `target`, minimizing total price. Return the minimum price, or `-1` if unreachable. Each machine may be chosen once.

Loading the problem…