Counting Words With a Given Prefix LeetCode solution in Python

1
class Solution:
2
def prefixCount(self, words: List[str], pref: str) -> int:
3
return sum(word.find(pref) == 0 for word in words)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0