classSolution:deflongestCommonPrefix(self, strs: List[str])->str:iflen(strs)==0:return''iflen(strs)==1:return strs[0]
res =''
index =0
min_len =len(strs[0])for i inrange(1,len(strs)):iflen(strs[i])< min_len:
index = i
min_len =len(strs[i])for i inrange(min_len):
tmp_list =[]for j inrange(len(strs)):
tmp_list.append(strs[j][i])
tmp =set(tmp_list)iflen(tmp)==1:
res += tmp_list[0]else:breakreturn res