Back to course home
0% completed
Vote For New Content
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`
s1ands2consist of only lowercase English characters.
Try it yourself
Try solving this question here:
.....
.....
.....
Like the course? Get enrolled and start learning!