```
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if len(strs) == 0:
return ""
else:
res = ""
b = [len(i) for i in strs]
MinL = reduce(lambda x, y: min(x, y), b)
for j in xrange(MinL):
head = map(lambda x: x[j], strs)
if len(set(head)) != 1:
break
else:
res += head[0]
return res
```