We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bac7302 commit ad07b65Copy full SHA for ad07b65
src/2024/day23.js
@@ -4,12 +4,12 @@ function unique(networks) {
4
}
5
6
function addOneToNetworks(networks, map) {
7
- networks = networks.flatMap(computers => {
+ let result = networks.flatMap(computers => {
8
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]);
+ let additions = candidates.reduce((a, b) => a.intersection(b));
+ return [...additions].map(add => [...computers, add]);
11
});
12
- return unique(networks);
+ return unique(result);
13
14
15
function parse(input) {
0 commit comments