Public
Edited
Dec 1, 2022
1 fork
1 star
Insert cell
Insert cell
totalCaloriesCarried = input.map((v) => _.sum(v))
Insert cell
mostCaloriesCarried = _.max(totalCaloriesCarried)
Insert cell
elvesSortedByCaloriesCarried = totalCaloriesCarried
.slice()
.sort((a, b) => b - a)
Insert cell
caloriesCarriedByTop3 = _.sum(elvesSortedByCaloriesCarried.slice(0, 3))
Insert cell
Insert cell
Insert cell
input = FileAttachment("01.txt")
.text()
.then((txt) => txt.split("\n\n").map((t) => t.split("\n").map((t) => parseInt(t))))
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