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 2e3476b commit ff11396Copy full SHA for ff11396
2021/day18/day18.raku
@@ -104,7 +104,11 @@ class Part1 is Solver { method solve( --> Str(Cool)) { magnitude(@.lines.reduce:
104
# Determine the maximum magnitude of adding any two pairs in the input, noting that addition is
105
# not commutative.
106
class Part2 is Solver {
107
- method solve( --> Str(Cool)) { (@.lines X @.lines).map({magnitude(add-pair($_[0], $_[1]))}).max }
+ method solve( --> Str(Cool)) {
108
+ (^@.lines X ^@.lines).grep({.head != .tail})
109
+ .map({magnitude(add-pair(@.lines[.head], $.lines[.tail]))})
110
+ .max
111
+ }
112
}
113
114
class RunContext {
0 commit comments