We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I spent a few days thinking about the problem and wanted to give some tips to those learning about dynamic programming.
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.
If you do it bottom up in Python try to optimize it because it might time out (mine did on the last 2 cases).
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.
Abbreviation
You are viewing a single comment's thread. Return to all comments →
I spent a few days thinking about the problem and wanted to give some tips to those learning about dynamic programming.
Hope this helps!