Dsa
Dynamic Programming
Easy
Longest Common Substring
Given two strings, write a function that finds the length of the longest common substring. The first line contains the string s1 (1 <= |s1| <= 100) and the second line contains the string s2 (1 <= |s2| <= 100). Output the length of the longest common substring.
Example:
Input:
abcde
abfce
Output:
2
Key concepts
dynamic_programmingstring
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now