bjorng

bjorng

Erlang Core Team

Advent of Code 2019 - Day 16

Note: This topic is to talk about Day 16 of the Advent of Code 2019.

There is a private leaderboard for elixirforum members. You can join it by following this link and entering the following code:

39276-eeb74f9a

Most Liked

bossek

bossek

If somebody is missing Stream solution of the part 2 today, here it is.

bjorng

bjorng

Erlang Core Team

Here is my solution.

I solved part 1 in the morning, but my program needed 17 seconds to find the answer.

That started my day of premature optimization. In hindsight, the problem with my original solution was probably that I used streams in a non-efficient way. I reimplemented part 1 with my own implementation of lazy lists. I hoped that it would be useful for part 2. It wasn’t.

When I saw that all examples and my input had offsets in second half of the input, I knew how to solve it. Unfortunately I did some more premature optimization and didn’t get it to work. I then took a look in the forum and saw all my premature optimizations were totally unnecessary. I wrote my own solution inspired by a quick look at @sasajuric’s solution.

My solution solves part 1 in 0.2 seconds and part 2 in about 3 seconds.

ferd

ferd

Author of Property-Based Testing with PropEr, LYSE, & Erlang in Anger

Day 16 really sucked.
I didn’t figure it out. I wouldn’t have figured it out. I just don’t know or didn’t recall the magical matrix properties I’d have needed to figure out from this specific input to make it work, so I spent a couple of hours floundering to get you this useless video that will teach nothing and that you should probably not watch:

I’m still bitter about this day being a damn loss of all my free time, it felt like failing a shitty whiteboard programming interview.

Where Next?

Popular in Challenges Top

bjorng
Note: This topic is to talk about Day 23 of the Advent of Code. For general discussion about the Advent of Code 2018 and links to topics...
New
Aetherus
This topic is about the Advent of Code 2021 - Day 4. Thanks to @bjorng , we now have a new Private Leaderboard. The entry code is: 370...
New
rugyoga
part 1 https://github.com/rugyoga/aoc2021/blob/main/day7.exs part 2 https://github.com/rugyoga/aoc2021/blob/main/day7b.exs
New
rugyoga
part 1: https://github.com/rugyoga/aoc2021/blob/main/day8.exs part 2: https://github.com/rugyoga/aoc2021/blob/main/day8b.exs
New
kwando
Took a while, but another use case for “move vectors” today and pattern matching. :slight_smile: The trick was to first generate a list...
New
jkwchui
Monkeys fitted squarely as GenServers in my head. My initial problem was using cast instead of call; I imagine impolite monkeys slinging...
New
kwando
Phew, this one took a while to get right. My naive attempts was way to slow so I reached for Dijkstras shortest path algorithm.. and that...
New
adamu
Nobody’s doing Advent of Code this year? :grinning_face_with_smiling_eyes: I might do the first week or so. For Day 1, first I solved i...
New
Aetherus
Don’t know why the regex ~r/[\W && [^\.]]/x does not work in Elixir. It works pretty well in Ruby. Anyway, here is my solution: ...
New
lud
Hello everyone! This year is going to be shorter, but the difficulty will grow faster. Today I already feel that this is not standard “D...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52774 488
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29703 241
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement