Skip to content

Commit 9a8894b

Browse files
committed
fix: update
1 parent 6a8d3d2 commit 9a8894b

File tree

3 files changed

+3
-15
lines changed

3 files changed

+3
-15
lines changed

solution/2400-2499/2416.Sum of Prefix Scores of Strings/README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,7 @@ function sumPrefixScores(words: string[]): number[] {
333333
for (const w of words) {
334334
trie.insert(w);
335335
}
336-
let ans = [];
337-
for (const w of words) {
338-
ans.push(trie.search(w));
339-
}
340-
return ans;
336+
return words.map(w => trie.search(w));
341337
}
342338
```
343339

solution/2400-2499/2416.Sum of Prefix Scores of Strings/README_EN.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,7 @@ function sumPrefixScores(words: string[]): number[] {
333333
for (const w of words) {
334334
trie.insert(w);
335335
}
336-
let ans = [];
337-
for (const w of words) {
338-
ans.push(trie.search(w));
339-
}
340-
return ans;
336+
return words.map(w => trie.search(w));
341337
}
342338
```
343339

solution/2400-2499/2416.Sum of Prefix Scores of Strings/Solution.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,5 @@ function sumPrefixScores(words: string[]): number[] {
3939
for (const w of words) {
4040
trie.insert(w);
4141
}
42-
let ans = [];
43-
for (const w of words) {
44-
ans.push(trie.search(w));
45-
}
46-
return ans;
42+
return words.map(w => trie.search(w));
4743
}

0 commit comments

Comments
 (0)