Write a function to find the longest common prefix string amongst an array of strings.
Solution:
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) { //runtime:4ms
string str="";
if(strs.empty())return str;
int index=; while(true){
if(index>=strs[].size())return str;
char c=strs[][index];
for(int i=;i<strs.size();i++){
if(index>=strs[i].size()||strs[i][index]!=c)return str;
}
str+=c;
index++;
} }
};