2025-08-18 12:03:06 +0000 UTC
Count Prefixes of a Given String
Categories:
Links
Code
class Solution:
def countPrefixes(self, words: List[str], s: str) -> int:
res = 0
for word in words:
if s.startswith(word):
res += 1
return res