We’re preparing your current view and syncing the latest data.
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 "".
An array of strings strs.
A string representing the longest common prefix.
0 <= strs.length <= 200 0 <= strs[i].length <= 200 strs[i] consists of only lowercase English letters.
Example 1
Input
["flower","flow","flight"]
Output
"fl"
Explanation
The longest common prefix of the input strings is "fl".
Example 2
Input
["dog","racecar","car"]
Output
""
Explanation
There is no common prefix among the input strings.