Code RoomCount distinct coin sums
MediumPrep Room Coding #1318

Count distinct coin sums

CodingAlgorithms & data structuresMid–Senior~25 min

You are stocking a vending machine's change drawer. coins gives the available denominations and limits[i] gives how many coins of denomination coins[i] you have. Return the number of distinct coin values (sums) from 1 up to and including the total available that you can make exact change for using the coins on hand. Constraints: 1 <= n <= 50, 1 <= coins[i] <= 500, 1 <= limits[i] <= 100.

Implement
count_makeable_values(coins: list[int], limits: list[int]) → int
Examples
in[[1,5],[2,1]]out5
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 25 min
InputExpectedGot
[[1,5],[2,1]]5not run yetsample