Longest Common Substring
InterviewTime limit1sMemory limit1024 MB
Given up to 1000 lowercase strings of length at most 100, find the length of the longest substring that appears in every string.
- Level
Medium6 of 10
- Topics
- String, Dynamic programming, Binary search, Hash map
- Solved
- No attempts yet
Problem
Given a list of strings, what is the longest substring common to all of them?
Input
The first line of input contains an integer (), which is the number of strings that follow.
Each of the next lines contains a single string () consisting only of lower-case letters.
Output
Output a single integer, which is the length of the longest substring common to all of the input strings.