Count Prefixes of a Given String LeetCode solution in Python

1
# Runtime: 74 ms (Top 25.9%) | Memory: 16.47 MB (Top 86.6%)
2

3

4
class Solution:
5
def countPrefixes(self, words: List[str], s: str) -> int:
6
return len([i for i in words if s.startswith(i)])

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0