From a70260cb8a25aa8a297f19348a5cf30b3ade0994 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Fri, 8 Dec 2023 09:55:52 +0100 Subject: [PATCH] d6p1 - read and parse input --- Day6/Part1.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Day6/Part1.js b/Day6/Part1.js index 3a620a8..6cb6a0d 100644 --- a/Day6/Part1.js +++ b/Day6/Part1.js @@ -1,8 +1,16 @@ import { readFileSync } from "fs"; const t0 = performance.now(); -const input = readFileSync("input.txt").toString(); -console.log(input); +const input = readFileSync("input.txt").toString().split("\n"); +const time = input[0] + .split(/\s{1,}/) + .slice(1) + .map(Number); +const distance = input[1] + .split(/\s{1,}/) + .slice(1) + .map(Number); +console.log(time, distance); const t1 = performance.now(); console.log(`Runtime: ${t1 - t0}ms`);