Skip to content

Commit 50fb942

Browse files
committed
add 1935
1 parent 7712c07 commit 50fb942

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

javascript/LeetCode/String/1935.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* 1935. Maximum Number of Words You Can Type
3+
*
4+
* @param {string} text
5+
* @param {string} brokenLetters
6+
* @return {number}
7+
*/
8+
var canBeTypedWords = function(text, brokenLetters) {
9+
const broken = new Set(brokenLetters);
10+
const split = text.split(" ");
11+
let ans = 0;
12+
13+
for(const t of split) {
14+
for(const c of t) {
15+
if(broken.has(c)){
16+
ans++;
17+
}
18+
}
19+
}
20+
return ans;
21+
};
22+
let text = "hello world", brokenLetters = "ad";
23+
// 1
24+
console.log(canBeTypedWords(text,brokenLetters));

javascript/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,4 +1045,5 @@ var fractionToDecimal = function(numerator, denominator) {
10451045
};
10461046
let numerator = 1, denominator = 2;
10471047
// "0.5"
1048-
// console.log(fractionToDecimal(numerator,denominator));
1048+
// console.log(fractionToDecimal(numerator,denominator));
1049+

0 commit comments

Comments
 (0)