Longest Common Prefix
Given the array of strings A, you need to find the longest string S which is the prefix of ALL the strings in the array.
Longest common prefix for a pair of strings S1 and S2 is the longest string S which is the prefix of both S1 and S2.
For Example, longest common prefix of "abcdefgh"
and "abcefgh"
is "abc"
.
Input Format
Output Format
For Example
Last updated