Published
Edited
Dec 8, 2020
Insert cell
md`# Advent of code 2020 - day 5`
Insert cell
answer2 = ids.find((el, index) => ids[index + 1] - el > 1) + 1
Insert cell
answer1 = Math.max(
...ids
)
Insert cell
// the seat ID is in binary, wow!
ids = data
.map(el =>
eval(`0b${el
.replaceAll('F', 0)
.replaceAll('B', 1)
.replaceAll('L', 0)
.replaceAll('R', 1)}
`)
)
.sort((a, b) => a - b)
Insert cell
data = puzzleInput.split('\n')
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