Coding Trainer

Coin Change

MediumDynamic Programmingk-0-1-knapsackk-dynamic-programmingLC #322

Problem

Given coins of different denominations and a total amount, return the fewest coins needed to make that amount. Return -1 if impossible.

Example: coins=[1,2,5], amount=11 → 3 (5+5+1)