Count distinct coin sums
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]) → intExamples
in
[[1,5],[2,1]]out5What 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
solution.py
InputExpectedGot
[[1,5],[2,1]]5not run yetsample