Public
Edited
Nov 30, 2023
1 fork
1 star
Insert cell
Insert cell
Insert cell
function part1(input) {
return AOC.sum(AOC.linesToNumbers(input));
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function part2(input) {
const freqs = new Set();
const deltas = AOC.linesToNumbers(input);
let freq = 0;
while (true) {
for (const delta of deltas) {
freq += delta;
if (freqs.has(freq)) {
return freq;
}
freqs.add(freq);
}
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more