adventofcode/2021/02/part1.mjs
2021-12-05 11:44:39 -05:00

9 lines
206 B
JavaScript

import fp from "lodash/fp.js";
export const solution = fp.flow([
fp.groupBy(0),
fp.mapValues(fp.map(fp.get(1))),
fp.mapValues(fp.sum),
({ forward, up, down }) => forward * (down - up),
]);