#
# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
#
# @param strs string字符串一维数组
# @return string字符串
#
class Solution:
def longestCommonPrefix(self , strs: List[str]) -> str:
# write code here
if not strs:
return ""
base = strs[0]
for i in range(len(base)):
for other in strs[1:]:
if i >= len(other) or base[i] != other[i]:
return base[:i]
return base



京公网安备 11010502036488号