请解释longestCommonPrefix函数的参数中的语法。此函数将字符串列表作为输入。
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
参数和->
描述了函数的类型。
def longestCommonPrefix(self, strs: List[str]) -> str:
pass
因此需要一个参数strs
,它是字符串列表[List[str]
)。然后它返回一个字符串(str
)。