Maximum Number of Words You Can Type LeetCode solution in Python

1
class Solution:
2
def canBeTypedWords(self, text: str, brokenLetters: str) -> int:
3
text = text.split()
4
length = len(text)
5
brokenLetters = set(brokenLetters)
6

7
for word in text:
8
for char in word:
9
if char in brokenLetters:
10
length -= 1
11
break
12

13
return length

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0