Ldef longestCommonPrefix(self, strs): # write your code here if ‘‘ in strs or strs == []: return ‘‘ s, n = ‘‘, ‘‘ for j in range(min([len(i) for i in strs])): for i in range(len(strs)): s += strs[i][j] if s == s[0]*len(s): n += s[0] s = ‘‘ return n
标签:log range min pos ret tco prefix com str
Ldef longestCommonPrefix(self, strs): # write your code here if ‘‘ in strs or strs == []: return ‘‘ s, n = ‘‘, ‘‘ for j in range(min([len(i) for i in strs])): for i in range(len(strs)): s += strs[i][j] if s == s[0]*len(s): n += s[0] s = ‘‘ return n
标签:log range min pos ret tco prefix com str
原文地址:https://www.cnblogs.com/tingway/p/8544003.html