mirror of
https://github.com/tomru/adventofcode.git
synced 2026-03-03 06:27:19 +01:00
day1
This commit is contained in:
18
day01/index.mjs
Normal file
18
day01/index.mjs
Normal 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);
|
||||||
|
|
||||||
2000
day01/input
Normal file
2000
day01/input
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user