educative.io

Educative

Longest Common Substring - Grokking Dynamic Programming Patterns for Coding

The solution here explains it wrong. dp[i][j] refers to the longest substring including s1[i], s2[j] , because the common substring between them doesn’t need these to be equal. Correct code with WRONG Explanation