Concept Flow - Longest Common Substring
Start with two strings
Create 2D table of size (m+1)x(n+1)
Initialize first row and column to 0
For each character pair (i,j):
If chars match: table[i
Update max length and position if needed
If chars don't match: table[i
After filling table, extract substring from max position
Return longest common substring
We build a table to track matching characters between two strings. When characters match, we extend the substring length. We keep track of the longest substring found.