function longestCommonPrefix( strs ) {
// write code here
if(strs.length == 1) return strs[0];
if(strs.includes("") || strs.length==0) return ""; //含有“”、数组长度为0
let str = strs[0];
for(let i = 0;i<str.length;i++){
for(let j = 1;j<strs.length;j++){
if(str[i] != strs[j][i]){
return str.slice(0,i);
}
}
}
return str;
}
module.exports = {
longestCommonPrefix : longestCommonPrefix
};