class Solution:
    # @param {string[]} strs
    # @return {string}
    def longestCommonPrefix(self, strs):
        prefix = ''
        
        if len(strs) == 0:
            return prefix
        if len(strs) == 1:
            return strs[0]
        
        num = len(strs)
        mi = len(strs[0])
        
        for i in xrange(num):
            if mi > len(strs[i]):
                mi = len(strs[i])
        
        flag = False
        for j in xrange(mi):
            tmp = strs[0][j]
            for i in xrange(len(strs)):
                if strs[i][j] != tmp:
                    flag = True
                    break
            if flag:
                break
            prefix = prefix + tmp
        
        return prefix

@@ -114,107 +114,19 @@
     
-prefix = ''%0A        %0A        if len(strs) == 0:%0A            return prefix%0A        if len(strs) == 1
+if not strs
 :%0A  
@@ -146,24 +146,11 @@
 urn 
-strs%5B0%5D%0A        
+%22%22%0A
 %0A   
@@ -158,186 +158,51 @@
     
-nu
 m
+i
  = len(
-strs)%0A        mi = len(strs%5B0%5D)%0A        %0A        for i in xrange(num):%0A            if mi %3E len(strs%5Bi%5D):%0A                mi = len(strs%5Bi%5D)%0A        %0A        flag = False
+min(strs, key = lambda s: len(s)))
 %0A   
@@ -231,37 +231,8 @@
 i):%0A
-            tmp = strs%5B0%5D%5Bj%5D%0A
     
@@ -255,16 +255,19 @@
  xrange(
+1, 
 len(strs
@@ -307,156 +307,63 @@
  != 
-tmp:%0A                    flag = True%0A                    break%0A            if flag:%0A                break%0A            prefix = prefix + tmp%0A        
+strs%5Bi - 1%5D%5Bj%5D:%0A                    return strs%5Bi%5D%5B:j%5D%0A
 %0A   
@@ -378,11 +378,17 @@
 urn 
-prefix
+strs%5B0%5D%5B:mi%5D
 %0A

Update LongComPrefix_001.py