Algorithms Catch-Up · The Index Is an Amount, the Value Is a Count: Dynamic Programming and Backtracking
Make exactly 6 with unlimited coins of value 1, 3 and 4. Derive the recurrence from the meaning of dp[x]: why it reads x−c, why worse paths can be discarded, and why six rounds of computation lead to a backtrace of just 6→3→0. Then apply the same reasoning to Unigram's Viterbi encoding.