Skip to content

Commit 0e670d5

Browse files
BarklimBarklim
authored andcommitted
Create 1358.js
1 parent d7fe340 commit 0e670d5

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

example/Dayly/1358.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* @param {string} s
3+
* @return {number}
4+
*/
5+
var numberOfSubstrings = function(s) {
6+
7+
};
8+
9+
const example1 = numberOfSubstrings('abcabc'); // 10
10+
const example2 = numberOfSubstrings('aaacb'); // 3
11+
const example3 = numberOfSubstrings('abc'); // 1
12+
13+
console.log(example1);
14+
console.log(example2);
15+
console.log(example3);
16+
17+
// var numberOfSubstrings = function(s) {
18+
// return solve(s, 3) - solve(s, 2)
19+
// };
20+
21+
// var solve = function(word, n) {
22+
// const vowels = new Set(['a', 'b', 'c'])
23+
// const freqMap = new Map()
24+
// let l = 0, r = 0, result = 0
25+
26+
// while (r < word.length) {
27+
// if (vowels.has(word[r])) {
28+
// freqMap.set(word[r], (freqMap.get(word[r]) || 0) + 1)
29+
// } else {
30+
// freqMap.clear()
31+
// l = r + 1
32+
// }
33+
34+
// while (freqMap.size > n) {
35+
// freqMap.set(word[l], freqMap.get(word[l]) - 1)
36+
// if (freqMap.get(word[l]) === 0) {
37+
// freqMap.delete(word[l])
38+
// }
39+
// l++
40+
// }
41+
42+
// result += r - l + 1
43+
// r++
44+
// }
45+
46+
// return result
47+
// }

0 commit comments

Comments
 (0)