1
2
3
4
5
6
7
|
class Solution:
def prefixCount(self, words: List[str], pref: str) -> int:
prefLength=len(pref)
cnt=0
for i in words:
if i[:prefLength]==pref : cnt+=1
return cnt
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 290. Word Pattern (0) | 2022.03.17 |
---|---|
leetcode 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence (0) | 2022.03.17 |
leetcode 557. Reverse Words in a String III (0) | 2022.03.17 |
leetcode 2000. Reverse Prefix of Word (0) | 2022.03.16 |
leetcode 1704. Determine if String Halves Are Alike (0) | 2022.03.16 |
댓글