Places visitable per price segment within budget
Problem Given price segments, e.g. prices = {100, 50, 25, 10, 5}, and a total budget, return how many places from each price segment can be visited so that the leftover budget is minimized.
Input / Output
- Input: int array prices (segment costs), int budget.
- Output: count per segment, minimizing the unspent remainder.
Constraints
- Clarify whether counts are unbounded per segment (coin-change style) or one place per segment; both variants should be discussed.
Example
- prices = {100, 50, 25, 10, 5}, budget = 190 → 1×100 + 1×50 + 1×25 + 1×10 + 1×5 = 190, leftover 0 → counts [1,1,1,1,1].
asked …