Platform
Resources
Pricing
Sign in
Get started
Vincent Raveneau
CNRS Research Engineer at LIRMM, Montpellier, France.
Workspace
Fork
Public
Advent of code 2022
By
Vincent Raveneau
Edited
Dec 1, 2022
1 fork
1 star
1
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
totalCaloriesCarried
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
mostCaloriesCarried
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
elvesSortedByCaloriesCarried
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
caloriesCarriedByTop3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
input
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML