Advent of Code 2017


Advent of code 2017 just started. It is a series of simple problems you can solve using any programming language.

Is anyone doing this year’s edition using Elixir or other functional languages? My solutions will be at my github.

Last year’s thread didn’t lead to any discussions but I think we can at least exchange solutions :slight_smile:


I do hope to get some more time to spare than the last 2 years and to finally solve the calender before new year…

Of course I have a repo as well:


I am. My solutions are on GitHub.


Not sure how much time will I have, but whatever I solve, I’ll post in this Twitter thread.




I’m using Elixir too!


I am also doing this years challenge in elixir, my solutions can be found at


Yay! :slight_smile:


I’ll be playing along also at GitHub.

It would be great to do this, but acknowledge that every day solving the solutions is probably enough. Anyhow, I’m already behind some time to catchup!!


I’ve only had time for Day 1 so far. I never finished it last year… Let’s see how far I get this year :smiley:


I’ve been getting rusty trying to split my time between Elixir in my free time and Node.js for client work, so I figure now is a perfect time to brush up on Elixir.

Here are my first four solutions:
Advent of Code 2017 - Day 01
Advent of Code 2017 - Day 02
Advent of Code 2017 - Day 03
Advent of Code 2017 - Day 04


I love doing challenges like this and looking at other peoples solutions. I’ve started Advent of Code the past two years but I’ve never finished. I’m determined this year. I started reading Seven Languages in Seven Weeks and plan on attempting them in some of the more obscure languages (namely prolog and io).

Here are my solutions for Day1 and Day2 in elixir, I’m hoping to knock out Day3 tonight as soon as I figure out a pattern in the spiral.

Day 1
Day 2


I just solved day 5 and I am quite unhappy with the runtime of my version. Especially the second assignment of today takes a long time. 10 to 15 seconds.

The code can be found in my repo: (but of course it spoils if you haven’t finished yet)

Day 5, second assignment, my slow solution
I'm currently thinking about implementing it with some kind of zypper, but if this would really provide any benefits, I'm unsure...


I was able to speed up the second assignment using some zypper like structure to take about 7 to 9 seconds.

Sadly the first assignment takes about 4 seconds then instead of ~1…

zypper version


I cut my runtime in half (10s to 5s) by using ets instead of a map… Still ruby does the same in about 2.5s on the same hardware


I get similar times (~ 15 sec), and I also use map to store instructions. I briefly tried with ETS, which shaved a few secs. One thing which I thought of, but didn’t try was to optimize the case where the current instruction is 0. In that case, you can skip extra map store/lookup and immediately move on to the next iteration (though you need to somehow indicate that you made two moves). I didn’t really have the time to try it out, and it would uglify the code, so I just left it as it was.


Hey all,

I’ve made a private leaderboard if any others want to join: 101181-38e9ecde.


Here’s my day 5 solution. I originally kept it simple using list lookups and replacements, and later made it a little faster by reducing the initial list into a map.

I spent some time (way too much time) trying to come up with a divide and conquer or backtracing algorithm to make things more efficient, but the changing offsets seemed to make this impossible. Sub-solutions can’t be guaranteed to be isolated. I’d love to see if someone found an efficient solution.


Me! I’m posting my solutions here:


Same, even though I’m using a handful of different languages - not exclusively Elixir: