Public
Edited
Nov 11, 2022
1 star
Insert cell
Insert cell
Insert cell
function parse(input) {
return input
.split('\n\n')
.map(str => str.split('\n'))
.map(strs => strs.map(str => new Set([...str])));
}
Insert cell
Insert cell
function part1(input) {
return AOC.sum(parse(input).map(group => AOC.unions(group).size));
}
Insert cell
Insert cell
Insert cell
Insert cell
function part2(input) {
return AOC.sum(parse(input).map(group => AOC.intersections(group).size));
}
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