3 changed files with 32 additions and 29 deletions
@ -1,2 +1,12 @@
@@ -1,2 +1,12 @@
|
||||
import * as R from "remeda"; |
||||
|
||||
export const solutionPart2 = R.createPipe( |
||||
(text) => text.split("\n"), |
||||
R.filter(R.identity), |
||||
R.map((line) => line.split("")), |
||||
R.chunk(3), |
||||
R.map((group) => group.reduce((a, b) => R.intersection(a, b))), |
||||
R.map((line) => line[0].charCodeAt(0)), |
||||
R.map((code) => (code > 96 ? code - 96 : code - 38)), |
||||
R.sumBy(R.identity) |
||||
); |
||||
|
Loading…
Reference in new issue