day 4 done

This commit is contained in:
2024-12-04 22:18:24 -05:00
parent ac3cf84618
commit 06f3e2411d
8 changed files with 182 additions and 16 deletions

View File

@@ -1,7 +1,11 @@
import fs from "node:fs";
import { Temporal } from "@js-temporal/polyfill";
import { printTime } from "../util";
const data = fs.readFileSync("./inputs/input", "utf8");
let timer = Temporal.Now.instant();
console.log(
"part one:",
data
@@ -45,9 +49,12 @@ console.log(
}
}
return total;
}, 0)
}, 0),
printTime(Temporal.Now.instant().since(timer))
);
timer = Temporal.Now.instant();
console.log(
"part two:",
data
@@ -124,5 +131,6 @@ console.log(
return { ...total, on: state.on };
},
{ sum: 0, on: true }
).sum
).sum,
printTime(Temporal.Now.instant().since(timer))
);