Count distinct coin sums

Write codeMedium25 min

Your task

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.

Examples

count_makeable_values(coins: list[int], limits: list[int]) -> int
Example 1
Inputcount_makeable_values([1, 5], [2, 1])
Output5