Grokking Dynamic Programming Patterns for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Why does the bottom-up table seem to have incorrect values for some positions, l...

Gary

Jul 3, 2022

Why does the bottom-up table seem to have incorrect values for some positions, like dp[2][3], which means the longest common substring between "cb" and "abd", which should be 1 instead of 0 since "b" is the one common substring?

0

0

Comments
Comments
G
Gary 3 years ago

and why does the recursive formula compare s1[i] and s2[j] when the code compares s1[i-1] vs s2[j-1]?

On this page

Problem Statement

Basic Solution

Code

Top-down Dynamic Programming with Memoization

Code

Bottom-up Dynamic Programming

Challenge

Hint