https://leetcode-cn.com/problems/longest-common-prefix/每日一题
class Solution(object): def longestCommonPrefix(self, strs): n = len(strs) ans = '' j = 0 if n == 0: return ans if n == 1: return strs[0] while 1: for i in range(1,n): if len(strs[i-1]) <= j or len(strs[i]) <= j : return ans if strs[i-1][j] != strs[i][j]: return ans ans = strs[0][:j+1] j = j+1