Case1:

Input: {1, 0 }, S=1

Expected output should be: 2, but both recursive solutions gets 1!

Case2:

Input: {0, 1}, S=1

Expected output should also be: 2, but the bottom up DP solution gets 1!

Something goes wrong with the basic condition or initial values, please try to correct it. Thx,

By the way, the same error also accurs in the ‘target sum’ lesson, since the both lessons share the same solution.

Course: Grokking Dynamic Programming Patterns for Coding Interviews - Learn Interactively

Lesson: Count of Subset Sum - Grokking Dynamic Programming Patterns for Coding Interviews