*
* @param strs string字符串一维数组
* @return string字符串
*/
function longestCommonPrefix( strs ) {
// write code here
if(strs.length == 0) return "";
let row = strs.length;
let col = strs[0].length;
for (let i = 0; i < col; i++){
const char = strs[0][i];
for (let j = 1; j < row; j++){
if (strs[j].length == i || strs[j][i] != char){
return strs[0].substr(0, i);
}
}
}
return strs[0];
}
module.exports = {
longestCommonPrefix : longestCommonPrefix
};