day 4 done
This commit is contained in:
12
03/index.ts
12
03/index.ts
@@ -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))
|
||||
);
|
||||
|
Reference in New Issue
Block a user