Didn't really have much time to do the challenges today, but yeah, whenever you did the first three days it's hard to skip one.
So here are my solutions in Elixir. Some function returns are a bit messy, but it does what it needs to do. The basic idea is that all lines are first parsed into a map with guards, where each guard is the key for another map containing the minutes and the number of times the guard was asleep during that minute.
Having that basic map makes the calculations for both strategies relatively easy.
Didn't really have much time to do the challenges today, but yeah, whenever you did the first three days it's hard to skip one.
So here are my solutions in Elixir. Some function returns are a bit messy, but it does what it needs to do. The basic idea is that all lines are first parsed into a map with guards, where each guard is the key for another map containing the minutes and the number of times the guard was asleep during that minute.
Having that basic map makes the calculations for both strategies relatively easy.
Common:
Part one:
Part two: