Skip to content

Commit f834c8b

Browse files
committed
Runtime: 438 ms (Top 7.57%) | Memory: 49.2 MB (Top 13.64%)
1 parent f4d2492 commit f834c8b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/algorithms/N/Number of Substrings Containing All Three Characters/Number of Substrings Containing All Three Characters.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 438 ms (Top 7.57%) | Memory: 49.2 MB (Top 13.64%)
12
/**
23
* @param {string} s
34
* @return {number}
@@ -8,7 +9,7 @@ var numberOfSubstrings = function(s) {
89
for(let i = 0, l = 0; i < s.length; i++) {
910
const c = s[i];
1011
map[c] = (map[c] || 0) + 1;
11-
12+
1213
while(Object.keys(map).length == 3) {
1314
ans += s.length - i;
1415
map[s[l]]--;
@@ -19,4 +20,4 @@ var numberOfSubstrings = function(s) {
1920
}
2021
}
2122
return ans;
22-
};
23+
};

0 commit comments

Comments
 (0)