Your question is Maximize Resource Allocation Value. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
At Nimbus Compute, you need to allocate a limited resource budget across a set of projects. Each project consumes a certain number of resource units and produces a value. Write a function that returns the maximum total value achievable without exceeding the budget.
This is a classic 0/1 resource allocation problem: each project can be selected at most once.
costs: a list of integers where costs[i] is the resource cost of project ivalues: a list of integers where values[i] is the value gained from project icapacity: an integer representing the total available resource unitscapacitydef optimal_resource_allocation(costs, values, capacity):