Please explain the syntax in the arguments of the longestCommonPrefix function. This function takes a list of strings as inputs.
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
Please explain the syntax in the arguments of the longestCommonPrefix function. This function takes a list of strings as inputs.
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
The arguments and the ->
describe the type of the function.
def longestCommonPrefix(self, strs: List[str]) -> str:
pass
So it takes one argument, strs
which is a list of strings (List[str]
).
Then it returns a string (str
).