bjorng
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
bjorng
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
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.
sasajuric
sasajuric
What if the input starts with 0000000? ![]()
370ms part 1
2.1s part 2







