Longest Common Prefix Java Solution - The Coding Shala
Home >> Interview Questions >> Longest Common Prefix
Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Explanation: There is no common prefix among the input strings.
All given inputs are in lowercase letters a-z.
Longest Common Prefix Java Solution
We will check character at every index of every string given in array if not matched then will break the loop.
Other Posts You May Like