mirror of
https://github.com/danbulant/adventOfCode
synced 2026-05-22 21:58:45 +00:00
24 lines
No EOL
432 B
TypeScript
24 lines
No EOL
432 B
TypeScript
|
|
const text = await Deno.readTextFile("./input");
|
|
const lines = text.split("\n");
|
|
|
|
let acc = 0;
|
|
let max = 0;
|
|
for(const line of lines) {
|
|
if(line === "") {
|
|
if(acc > max) {
|
|
max = acc;
|
|
}
|
|
console.log(acc);
|
|
acc = 0;
|
|
continue;
|
|
}
|
|
acc += parseInt(line);
|
|
if(isNaN(acc)) {
|
|
console.log("'" + line + "'");
|
|
break;
|
|
}
|
|
}
|
|
|
|
console.log();
|
|
console.log("max", max); |