Back to course home
0% completed
Longest Common Substring
Problem Statement
Given two strings 's1' and 's2', find the length of the longest substring which is common in both the strings.
Example 1:
Input: s1 = "abdca"
s2 = "cbda"
Output: 2
Explanation: The longest common substring is "bd".
Example 2:
Input: s1 = "passport"
s2 = "ppsspt"
Output: 3
Explanation: The longest common substring is "ssp".
Constraints:
- 1 <= s1.length, s2.length <= 1000`
s1
ands2
consist of only lowercase English characters.
Try it yourself
Try solving this question here:
Python3
Python3
. . . .
Mark as Completed
Table of Contents
Problem Statement
Try it yourself