# # # @param strs string字符串一维数组 # @return string字符串 # class Solution: def longestCommonPrefix(self , strs ): # write code here if len(strs) < 1: return '' if len(strs) == 1: return strs[0] m = min(map(len, strs)) for i in range(m): if all([strs[j][i] == strs[0][i] for j in range(len(strs))]): continue else: return strs[0][:i] return strs[0][:m]