Coin change ways
Your task
Given an integer amount and a list of distinct positive coin denominations (unlimited supply of each), return the number of distinct combinations of coins that sum to exactly amount. Combinations are unordered, so {1,2} and {2,1} count once. Return 0 if it cannot be made; amount may be 0 (one way: use no coins).
Examples
coin_combinations(amount: int, coins: list[int]) -> intExample 1
Input
coin_combinations(5, [1, 2, 5])Output
4