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.

sasajuric

sasajuric

Author of Elixir In Action

This is my solution for day 16. I’m not happy with part 2, because the solution only works if the requested sequence is in the second half. On the upside, part 1 is reasonably fast (about 400 ms on my machine).

sasajuric

sasajuric

Author of Elixir In Action

What if the input starts with 0000000? :slight_smile:

370ms part 1
2.1s part 2

Where Next?

Popular in Challenges Top

bjorng
This topic is about Day 14 of the Advent of Code 2020 . Thanks to @egze, we have a private leaderboard: https://adventofcode.com/2020/l...
New
NobbZ
Note by the Moderators: This topic is to talk about the Day 2 of the Advent of Code. For general discussion about the Advent of Code 201...
New
igorb
Today is a brute-force day: advent-of-code-2024/lib/advent_of_code2024/day6.ex at main · ibarakaiev/advent-of-code-2024 · GitHub Takes a...
New
Qqwy
Note by the Moderators: This topic is to talk about Day 6 of the Advent of Code. For general discussion about the Advent of Code 2018 an...
New
sb8244
Note: This topic is to talk about Day 10 of the Advent of Code 2019 . There is a private leaderboard for elixirforum members. You can jo...
New
christhekeele
Continuation of Advent of Code 2022​:christmas_tree:, Day 1: Day 2! Leaderboard:
New
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
bjorng
This topic is about Day 2 of the Advent of Code 2021. We have a private leaderboard (shared with users of Erlang Forums): https://adven...
New
connorlay
Note by the Moderators: This topic is for general discussion about the Advent of Code 2018. To prevent people from being spoiled about s...
New
seeplusplus
Hello all, hopefully I post this before someone else does and I don’t dupe. IMO Day 4 was much easier than Day 3 (yay, I can sleep befor...
New

Other popular topics Top

freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
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

We're in Beta

About us Mission Statement