Skip to content

Commit 8ff17f3

Browse files
authored
Create e1160.py
1 parent 6718ddb commit 8ff17f3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

my-submissions/e1160.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def countCharacters(self, words: List[str], chars: str) -> int:
3+
chars = Counter(chars)
4+
5+
output = 0
6+
for word in words :
7+
wordCnt = Counter(word)
8+
if all(wordCnt[x] <= chars[x] for x in wordCnt) :
9+
output += len(word)
10+
11+
return output

0 commit comments

Comments
 (0)