Skip to content

Commit ad07b65

Browse files
committed
refactor
1 parent bac7302 commit ad07b65

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/2024/day23.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ function unique(networks) {
44
}
55

66
function addOneToNetworks(networks, map) {
7-
networks = networks.flatMap(computers => {
7+
let result = networks.flatMap(computers => {
88
let candidates = computers.map(c => map.get(c));
9-
let result = [...candidates.reduce((a, b) => a.intersection(b))];
10-
return result.map(x => [...computers, x]);
9+
let additions = candidates.reduce((a, b) => a.intersection(b));
10+
return [...additions].map(add => [...computers, add]);
1111
});
12-
return unique(networks);
12+
return unique(result);
1313
}
1414

1515
function parse(input) {

0 commit comments

Comments
 (0)