adventofcode/2021/02/part1.mjs

9 lines
206 B
JavaScript
Raw Normal View History

2021-12-05 16:44:39 +00:00
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),
]);