Feature Budget Knapsack
A release planning tool picks which features to ship in a sprint. Each feature has an engineering cost and a projected value, and the sprint has a fixed capacity. Each feature is shipped at most once. Maximise total value within the capacity.
Problem
Given arrays cost and value of equal length and a capacity, choose a subset of items (each at most once) whose total cost does not exceed capacity, maximising total value. Return that maximum value.
Input
Arrays cost and value of length m (1 ≤ m ≤ 200), positive ints, and capacity (0 ≤ capacity ≤ 10^4).
Output
A single integer — the maximum achievable value.
Constraints
- Each item may be used at most once (0/1)
- 1 ≤ m ≤ 200; 0 ≤ capacity ≤ 10,000
- Total cost must not exceed capacity
Examples
Example 1
Input
cost = [1, 3, 4, 5], value = [1, 4, 5, 7], capacity = 7
Output
9
Pick items with cost 3 and 4 (total 7) for value 4 + 5 = 9, beating any other within-budget subset.
Example 2
Input
cost = [2], value = [5], capacity = 1
Output
0
The only item exceeds the capacity, so nothing is shipped.