<filename>longest-common-prefix/solution.py<gh_stars>0
class Solution:
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if len(strs) == 0:
            return ''
        prefix = strs[0]
        while not all([s.startswith(prefix) for s in strs]):
            prefix = prefix[:-1]
            if len(prefix) == 0:
                break
        return prefix

<filename>longest-common-prefix/solution.py<gh_stars>0
class Solution:
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if len(strs) == 0:
            return ''
        prefix = strs[0]
        while not all([s.startswith(prefix) for s in strs]):
            prefix = prefix[:-1]
            if len(prefix) == 0:
                break
        return prefix

:type strs: List[str]         :rtype: str