• + 1 comment

    I spent a few days thinking about the problem and wanted to give some tips to those learning about dynamic programming.

    1. Try to first solve it recursively with small sample cases and then try to apply memoization. Do not start thinking about the dynamic approach because I got lost doing that and was not sure how to apply a single base case.
    2. If you do it bottom up in Python try to optimize it because it might time out (mine did on the last 2 cases).
    3. Try doing it with True and False as the values of the DP table, this way you don't have to think about numbers and edit distances and stuff.

    Hope this helps!