SolutionPython enumerate()函数 Solutiondef longestCommonPrefix(self, strs): if not strs: return "" shortest = min(strs, key=len) for i, ch in enumerate(shortest): for other in strs: if other[i] != ch: return shortest[:i] return shortest Python enumerate()函数