You're solving the classic unbounded knapsack problem. Amazon asks it frequently. Here's the pattern: when you can reuse items unlimited times, iterate through amounts and try each item. This differs from / knapsack where each item is used once. Follow-up Coin Change II asks for the number of combinations, not minimum coins. Same structure, different aggregation (sum instead of min).
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/dynamic-programming/coin-change-why-this-problem
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████████████████████████████