mirror of
https://github.com/peter-tanner/advent-of-code-2023.git
synced 2024-11-30 14:00:16 +08:00
9 lines
219 B
TypeScript
9 lines
219 B
TypeScript
import * as fs from "fs";
|
|
const sum = fs
|
|
.readFileSync("input", "utf8")
|
|
.replace(/[^0-9\n]/g, "")
|
|
.split("\n")
|
|
.map((e) => parseInt(e[0] + e.at(-1)))
|
|
.reduce((sum, value) => sum + value, 0);
|
|
console.log(sum);
|