Day 1 part 1 done
This commit is contained in:
parent
1cf553f55b
commit
608f8cf49b
10
.vim/coc-settings.json
Normal file
10
.vim/coc-settings.json
Normal 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
1
2021/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.input
|
11
2021/1.ts
Normal file
11
2021/1.ts
Normal 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
1
2021/deps.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export { readLines } from "https://deno.land/std@0.116.0/io/mod.ts";
|
Loading…
Reference in a new issue