r/adventofcode • u/daggerdragon • Dec 04 '18
SOLUTION MEGATHREAD -π- 2018 Day 4 Solutions -π-
--- Day 4: Repose Record ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 4
Transcript:
Todayβs puzzle would have been a lot easier if my language supported ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
38
Upvotes
View all comments
1
u/Sentreen Dec 05 '18
Elixir
I decided to create a map which maps guard ids to a collection of how many times they were awake each minute. The reduction to create that map got pretty.... messy. However, once I had that map, it was fairly easy to get the answer to both parts.
Note that the
aoc 2018, 4is a simply macro that generates a module with some predefined functions (specifically theinput, which loads the input file into a stream of strings).