Skip to content

Commit 86b5612

Browse files
authored
Update Solution.js
1 parent 95eacb4 commit 86b5612

File tree

1 file changed

+4
-4
lines changed
  • solution/2700-2799/2707.Extra Characters in a String

1 file changed

+4
-4
lines changed

solution/2700-2799/2707.Extra Characters in a String/Solution.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
* @param {string[]} dictionary
44
* @return {number}
55
*/
6-
var minExtraChar = function(s, dictionary) {
6+
var minExtraChar = function (s, dictionary) {
77
const ss = new Set(dictionary);
88
const n = s.length;
9-
const f = new Array(n + 1).fill(0);
9+
const f = Array(n + 1).fill(0);
1010
for (let i = 1; i <= n; ++i) {
1111
f[i] = f[i - 1] + 1;
1212
for (let j = 0; j < i; ++j) {
13-
if (ss.has(s.substring(j, i))) {
13+
if (ss.has(s.slice(j, i))) {
1414
f[i] = Math.min(f[i], f[j]);
1515
}
1616
}
1717
}
18-
return f[n];
18+
return f[n];
1919
};

0 commit comments

Comments
 (0)