Write a function to find the longest common prefix string amongst an array of strings.
class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if len(strs) <= 0:
return ""
prefix = strs[0]
for s in strs[1:]:
i = 0
while i < len(prefix):
if i >= len(s) or prefix[i] != s[i]:
prefix = prefix[:i]
break
else:
i += 1
return prefix