advent-of-code/2021/1.ts

12 lines
329 B
TypeScript
Raw Normal View History

2021-12-01 08:43:02 -06:00
import { readLines } from "./deps.ts";
// Day 1
let increases = 0;
let lastDepth = Number.MAX_VALUE;
for await (const depthString of readLines(await Deno.open("1.input"))) {
const depth = parseInt(depthString);
if (depth > lastDepth) increases++;
lastDepth = depth;
}
console.log("Number of depth increases:", increases);