First find the length of shortest str, and than iterate to find qualified prefix

```
def longestCommonPrefix(self, strs):
minL = min(map(len, strs)) if strs else 0
for i in range(minL):
for j in range(1, len(strs)):
if strs[j][i] != strs[0][i]:
return strs[0][:i]
return strs[0][:minL] if minL else ""
```