Public
Edited
Sep 4, 2022
1 fork
2 stars
Insert cell
Insert cell
Insert cell
function numIncs(xs, lag = 1) {
return xs.reduce((incs, x, i) => (incs += x > xs[i - lag]), 0);
}
Insert cell
function part1(input) {
return numIncs(input);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function part2(input) {
return numIncs(input, 3);
}
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