Public
Edited
Dec 6, 2022
Insert cell
Insert cell
Insert cell
input = FileAttachment("input.txt").text()
Insert cell
calTotals = input
.split("\n\n")
.map(calTotal => calTotal
.split("\n")
.reduce((total, currentValue) => total + Number(currentValue), 0)
)
.sort((a, b) => b - a);
Insert cell
calTotals[0]
Insert cell
Insert cell
calTotals.slice(0, 3).reduce((total, currentValue) => total + currentValue)
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