14. 最长公共前缀
14. 最长公共前缀
方法一
import itertools class Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str """ prefix="" for i in itertools.izip(*strs): s= "".join(i) if len(s)!=s.count(s[0]): break prefix+=s[0] return prefix