Reputation: 107
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:
Upvotes: 0
Views: 841
Reputation: 3555
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
).
Upvotes: 2