Some problems look like they need a simple greedy choice, but the locally best step leads to a worse total. Dynamic programming solves them by building the answer for every smaller amount and reusing those results. Use it when the problem asks for a minimum count or the number of ways, and small cases repeat inside big ones, as in making change with coins. If a greedy rule can be proved correct, it is simpler and faster, so try to find a counter-example first.