init d15p2

This commit is contained in:
Baipyrus 2023-12-15 20:38:40 +01:00
parent d6d3a06b85
commit 138b4e2944

12
Day15/Part2.js Normal file
View File

@ -0,0 +1,12 @@
import { readFileSync } from "fs";
const t0 = performance.now();
const input = readFileSync("input.txt").toString().split("\n")[0].split(",");
const hashes = input.map((e) =>
e.split("").reduce((a, i) => ((a + i.charCodeAt(0)) * 17) % 256, 0)
);
const sum = hashes.reduce((a, i) => a + i);
console.log(sum);
const t1 = performance.now();
console.log(`Runtime: ${t1 - t0}ms`);