Files
adventofcode2024/day3/pt1.ts
Joey Eamigh b606826561 day3
2024-12-03 20:09:32 -05:00

10 lines
297 B
TypeScript

const input = await Bun.file('./inputs/day3').text();
const regex = /mul\((?<first>\d+)\,(?<second>\d+)\)/g;
const total = input
.matchAll(regex)
.map(({ groups }) => Number(groups!.first) * Number(groups!.second))
.reduce((curr, acc) => curr + acc);
console.log(`sum of mult: ${total}`);