Platform
Resources
Pricing
Sign in
Get started
Visnu Pitiyanuvath
Workspace
Fork
Published
Advent of Code 2018
By
Visnu Pitiyanuvath
Edited
Dec 4, 2018
Insert cell
Insert cell
ids
.
reduce
(
(
max
,
id
,
i
,
ids
)
=>
{
const
longer
=
ids
.
slice
(
i
+
1
)
.
map
(
other
=>
intersection
(
id
,
other
)
)
.
find
(
c
=>
c
.
length
>
max
.
length
)
return
longer
||
max
}
,
''
)
Insert cell
function
intersection
(
s1
,
s2
)
{
const
l1
=
s1
.
split
(
''
)
,
l2
=
s2
.
split
(
''
)
return
l1
.
filter
(
(
c
,
i
)
=>
c
===
l2
[
i
]
)
.
join
(
''
)
}
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
intersection
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
checksum
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
ids
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
input2
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
_
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML