This commit is contained in:
Thomas Ruoff
2021-12-02 23:48:42 +01:00
commit 7343b0fe9e
2 changed files with 2018 additions and 0 deletions

18
day01/index.mjs Normal file
View File

@@ -0,0 +1,18 @@
import * as readline from 'node:readline';
import * as fs from 'node:fs';
const rl = readline.createInterface({
input: fs.createReadStream('./input')
});
let last = null;
let counter = 0;
for await (const line of rl) {
const v = parseInt(line, 10);
if (last !== null && v > last) counter++;
last = v;
}
console.log(counter);