Day 1 part 1 done

This commit is contained in:
Daniel Flanagan 2021-12-01 08:43:02 -06:00
parent 1cf553f55b
commit 608f8cf49b
Signed by: lytedev
GPG Key ID: 5B2020A0F9921EF4
4 changed files with 23 additions and 0 deletions

10
.vim/coc-settings.json Normal file
View File

@ -0,0 +1,10 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": true,
"prettier.disableLanguages": [
"typescript",
"javascript"
],
"tsserver.enable": false
}

1
2021/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.input

11
2021/1.ts Normal file
View File

@ -0,0 +1,11 @@
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);

1
2021/deps.ts Normal file
View File

@ -0,0 +1 @@
export { readLines } from "https://deno.land/std@0.116.0/io/mod.ts";