NobbZ
Advent of Code - Day 3
Note by the Moderators: This topic is to talk about Day 3 of the Advent of Code.
For general discussion about the Advent of Code 2018 and links to topics of the other days, see this topic.
And day 3 is solved as well.
On my VM in the office both parts take about 1 to 1.25 seconds. Thats OK for me today. But the first iteration I used to get the actual solutions has some repitions in it, which I do not like.
I really have to iterate on those, and perhaps I’ll be even able to get them more efficient?
Most Liked
yawaramin
I approached Day 3 as a set intersection problem, the only issue was finding a data structure to represent the claims that would be usable as set elements (i.e. comparable for uniqueness). I realized I could cleanly map each claim to a set of coordinates of the exact square inches of that claim; after that the solution fell into place as a series of set intersections and unions.
Here it is: https://github.com/yawaramin/advent_of_code_2018/blob/d65581aeb7b25f40d22a05c1435b1401b2505fef/lib/day3.ex
Btw, I thought I’d share this fun fact that Elixir is in the top ten (at 10th) languages being used for Advent of Code projects on GitHub: https://github.com/search?o=desc&q=advent+of+code&s=updated&type=Repositories








