Concept Flow - Longest Common Substring
Start with two strings
Create 2D array dp
For each char in string1
For each char in string2
If chars match
dp[i
Update max length and position
Else dp[i
After loops, extract substring from max position
Return longest common substring
End
We compare characters of two strings using a 2D table to find the longest matching substring by building lengths step-by-step.
