Longest Common Substring
Problem Statement
Given two strings. The task is to find the length of the longest common substring.
Example 1:
Example 2:
Your Task: You don't need to read input or print anything. Your task is to complete the function longestCommonSubstr() which takes the string S1, string S2 and their length n and m as inputs and returns the length of the longest common substring in S1 and S2.
Expected Time Complexity: O(n*m). Expected Auxiliary Space: O(n*m).
Constraints: 1<=n, m<=1000
Intuition
Links
https://practice.geeksforgeeks.org/problems/longest-common-substring1452/1
Video Links
Approach 1:
C++
Approach 2:
C++
Approach 3:
C++
Approach 4:
C++
Similar Problems
Last updated