Skip to content

Commit

Permalink
Update day02.js
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata authored Dec 2, 2024
1 parent ea41769 commit 48fef63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/2018/day02.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function part2(input) {
for (let i = 0; i < arr.length; i++) {
const without = arr.map((x, index) => (index === i ? "*" : x)).join("");
if (memory.has(without)) {
return without.replace(/\*/g, "");
return without.replace(/\*/, "");

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This replaces only the first occurrence of /\*/.
} else {
memory.add(without);
}
Expand Down

0 comments on commit 48fef63

Please sign in to comment.