func longestCommonPrefix(strs []string) string {
j := 0
if len(strs) == 1 {
return strs[0]
} else if len(strs) == 0 {
return “”
} else {
min := math.MaxInt32
for i := 0; i <= len(strs)-1; i++ {
if min > len(strs[i]) {
min = len(strs[i])
}
}
if min == 0 {
return “”
} else {
cd := strs[0][0 : j+1]
for {
for i := 1; i <= len(strs)-1; i++ {
if strings.Index(strs[i], cd) != 0 {
return cd[0 : len(cd)-1]
}
}
j += 1
if len(cd)<len(strs[0]){
cd = strs[0][0:j]
}else{
break
}
}
return cd
}
}
}