🔥 Burn Fat Fast. Discover How! 💪

#N1935. Maximum Number of Words You Can Type problem link #so | Leetcode in Java && MySQL

#N1935. Maximum Number of Words You Can Type
problem link

#solution
class Solution {
public int canBeTypedWords(String text, String brokenLetters) {
int broken[] = new int[26], count = 0;;

for(char ch: brokenLetters.toCharArray())
broken[ch-'a']++;

for(String word: text.split(" ")){
int countLength=0;

for(char ch: word.toCharArray())
if(broken[ch-'a'] == 0) countLength++;

if(countLength == word.length()) count++;
}

return count;
}
}