https://leetcode.com/problems/count-the-number-of-consistent-strings/description/
1
2
3
4
5
6
7
8
9
|
class Solution:
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
answer = 0
for word in words:
for alphabet in allowed:
word = word.replace(alphabet,'')
if word == '':
answer+=1
return answer
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
codeforces 158A - Next Round (0) | 2023.01.25 |
---|---|
백준 26560 Periods (0) | 2023.01.24 |
leetcode 58. Length of Last Word (0) | 2023.01.21 |
leetcode 2404. Most Frequent Even Element (0) | 2023.01.19 |
leetcode 2465. Number of Distinct Averages (0) | 2023.01.19 |
댓글