Core Idea
Let dp[s] be the minimum number of coins needed to make sum s. The answer is built from smaller sums.
Algorithm
Initialize dp[0] = 0 and all other sums as unreachable. For each sum, try every coin and relax dp[s + coin] or compute dp[s] from dp[s - coin].
Common Mistakes
Use a large sentinel for unreachable sums. If the target remains unreachable, print -1 rather than the sentinel.