class Solution(object):
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if len(strs)==0:
            return ""
        lcp=list(strs[0])
        for i,string in enumerate(strs):
            if list(string[0:len(lcp)])==lcp:
                continue
            else:
                while len(lcp)>0 and list(string[0:len(lcp)])!=lcp:
                    lcp.pop()
                if lcp==0:
                    return ""
        return "".join(lcp)

class Solution(object):
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if strs is None or strs == "":
            return ""
        lcp = list(strs[0])
        for i, string in enumerate(strs):
            if list(string[0:len(lcp)]) == lcp:
                continue
            else:
                while len(lcp) > 0 and list(string[0:len(lcp)]) != lcp:
                    lcp.pop()
                if lcp == 0:
                    return ""
        return "".join(lcp)

a = Solution()
print(a.longestCommonPrefix(["apps","apple","append"]) == "app")

Add test case to 014
Add test case to 014

  class Solution(object):
      def longestCommonPrefix(self, strs):
          """
          :type strs: List[str]
          :rtype: str
          """
-         if len(strs)==0:
+         if strs is None or strs == "":
              return ""
-         lcp=list(strs[0])
+         lcp = list(strs[0])
-         for i,string in enumerate(strs):
+         for i, string in enumerate(strs):
-             if list(string[0:len(lcp)])==lcp:
+             if list(string[0:len(lcp)]) == lcp:
                  continue
              else:
-                 while len(lcp)>0 and list(string[0:len(lcp)])!=lcp:
+                 while len(lcp) > 0 and list(string[0:len(lcp)]) != lcp:
                      lcp.pop()
-                 if lcp==0:
+                 if lcp == 0:
                      return ""
          return "".join(lcp)
  
+ a = Solution()
+ print(a.longestCommonPrefix(["apps","apple","append"]) == "app")
+ 
Add test case to 014
## Code Before:
class Solution(object):
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if len(strs)==0:
            return ""
        lcp=list(strs[0])
        for i,string in enumerate(strs):
            if list(string[0:len(lcp)])==lcp:
                continue
            else:
                while len(lcp)>0 and list(string[0:len(lcp)])!=lcp:
                    lcp.pop()
                if lcp==0:
                    return ""
        return "".join(lcp)

## Instruction:
Add test case to 014
## Code After:
class Solution(object):
    def longestCommonPrefix(self, strs):
        """
        :type strs: List[str]
        :rtype: str
        """
        if strs is None or strs == "":
            return ""
        lcp = list(strs[0])
        for i, string in enumerate(strs):
            if list(string[0:len(lcp)]) == lcp:
                continue
            else:
                while len(lcp) > 0 and list(string[0:len(lcp)]) != lcp:
                    lcp.pop()
                if lcp == 0:
                    return ""
        return "".join(lcp)

a = Solution()
print(a.longestCommonPrefix(["apps","apple","append"]) == "app")
