题目描述:
答案:
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
a= len(strs)
if not str:
return ""
b = strs[0]
c=len(b)
for i in range(c):
for j in range(1,a):
if i ==len(strs[j]) or b[i] != strs[j][i]:
return b[0:i]
return b
c此处:if a == 0 与if not str 相同