def find_com_str(l):
m =max(l)
n =min(l)
print max(l)
if len(l) ==0:
return ""
le1 =len(n)
for iin range(le1):
if m[i] != n[i]:
return m[0:i]
if __name__ =='__main__':
l = ["fw1lwer","fw1low","fw1lwight"]
print find_com_str(l)
def find_com_str(l):
m =max(l)
n =min(l)
print max(l)
if len(l) ==0:
return ""
le1 =len(n)
for iin range(le1):
if m[i] != n[i]:
return m[0:i]
if __name__ =='__main__':
l = ["fw1lwer","fw1low","fw1lwight"]
print find_com_str(l)
本文标题:14. 最长公共前缀
本文链接:https://www.haomeiwen.com/subject/iljgtktx.html
网友评论