Welcome to decision’s documentation!
Note
If object is not listed in documentation it should be considered as implementation detail that can change and should not be relied upon.
- decision.partition.coin_change(amount: int, denominations: Iterable[int], /) tuple[int, ...][source]
Solves coin change problem: what is the minimal number of coins of given unique denominations such that their sum will be no less than the given amount?
>>> coin_change(0, [2, 3]) () >>> coin_change(5, [2, 3]) (2, 3) >>> coin_change(5, [2, 3, 5]) (5,) >>> coin_change(15, [2, 3]) (3, 3, 3, 3, 3) >>> coin_change(15, [2, 3, 5]) (5, 5, 5)