Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad07b65

Browse filesBrowse files
committed
refactor
1 parent bac7302 commit ad07b65
Copy full SHA for ad07b65

File tree

1 file changed

+4
-4
lines changed
Filter options

1 file changed

+4
-4
lines changed

‎src/2024/day23.js

Copy file name to clipboardExpand all lines: src/2024/day23.js
+4-4Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.