Use two sub-arrays to compare with each other. Although the waste on time is O(n^2), it is fast enough to AC:

```
class Solution:
# @param {string[]} strs
# @return {string}
def longestCommonPrefix(self, strs):
if not strs:
return ''
lcp_len = len(strs[0])
lcp0 = strs[0]
lcp1 = ''
for i in xrange(1, len(strs)):
lcp_len = min(lcp_len, len(strs[i]))
for j in xrange(lcp_len):
if lcp0[j] == strs[i][j]:
lcp1 += strs[i][j]
else:
break
lcp0 = lcp1
lcp1 = ''
lcp_len = len(lcp0)
return lcp0
```

First AC solution by myself, comments and suggestions please!