Skip to content

Commit 963a280

Browse files
authoredJul 18, 2021
Create 1935-maximum-number-of-words-you-can-type.js
1 parent e69d616 commit 963a280

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @param {string} text
3+
* @param {string} brokenLetters
4+
* @return {number}
5+
*/
6+
const canBeTypedWords = function(text, brokenLetters) {
7+
const set = new Set(brokenLetters.split(''))
8+
const arr = text.split(' ')
9+
let res = 0
10+
for(let e of arr) {
11+
let ok = true
12+
for(let c of e) {
13+
if(set.has(c)) {
14+
ok = false
15+
break
16+
}
17+
}
18+
if(ok) res++
19+
}
20+
21+
return res
22+
};

0 commit comments

Comments
 (0)
Please sign in to comment.