Step 1: Initialize dp array with dp[0] = 0 and others as large number
dp: [0, ∞, ∞, ∞, ∞, ∞, ∞]
Why: 0 coins needed to make amount 0; others unknown yet
Step 2: Calculate dp[1]: try coin 1 (1 ≤ 1), dp[1] = min(dp[1], dp[0]+1) = 1
dp: [0, 1, ∞, ∞, ∞, ∞, ∞]
Why: 1 coin of 1 makes amount 1
Step 3: Calculate dp[2]: try coin 1 (1 ≤ 2), dp[2] = min(∞, dp[1]+1) = 2
dp: [0, 1, 2, ∞, ∞, ∞, ∞]
Why: two coins of 1 make amount 2
Step 4: Calculate dp[3]: try coins 1 and 3; dp[3] = min(∞, dp[2]+1, dp[0]+1) = 1
dp: [0, 1, 2, 1, ∞, ∞, ∞]
Why: one coin of 3 makes amount 3
Step 5: Calculate dp[4]: try coins 1,3,4; dp[4] = min(∞, dp[3]+1, dp[1]+1, dp[0]+1) = 1
dp: [0, 1, 2, 1, 1, ∞, ∞]
Why: one coin of 4 makes amount 4
Step 6: Calculate dp[5]: try coins 1,3,4; dp[5] = min(∞, dp[4]+1, dp[2]+1, dp[1]+1) = 2
dp: [0, 1, 2, 1, 1, 2, ∞]
Why: two coins (e.g., 4+1) make amount 5
Step 7: Calculate dp[6]: try coins 1,3,4; dp[6] = min(∞, dp[5]+1, dp[3]+1, dp[2]+1) = 2
dp: [0, 1, 2, 1, 1, 2, 2]
Why: two coins (e.g., 3+3) make amount 6
Result: dp: [0, 1, 2, 1, 1, 2, 2]
Minimum coins needed: 2