Day 19 -- Solutions
Similar as well (splitting ranges) https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2023/day19.clj
The annoying thing about Clojure core is that so few functions accept multiple sequences, only map and mapv do, so you always have to repackage 2 sequences into sequence of pairs then the 2-arity function cannot be used and you have to apply. Example:
(every? true? (mapv <= [0 0 0] [4 5 5]))
https://gist.github.com/RokLenarcic/b586acd3be4d55c07af2a386ea61080e
https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2023/day_19.clj
https://github.com/rjray/advent-2023-clojure/blob/master/src/advent_of_code/day19.clj I wrote part 1 much like a previous years' "machine" challenge. When it came to part 2, my brain locked. I looked to a Perl solution, but had trouble adapting it due to all the in-place modification of values (ironic, since I was a hard-core Perl guy for 25+ years). I then looked to @erdos's solution, which bridged the gap for me.
I improved my solution to be shorter
I see that weβre all in about same ballpark as far as lines of code are concerned
I'm not much of a code-golf person, so my solutions tend to be a bit longer. I find it novel to be able to read/understand my code months/years later π.
My https://github.com/wevre/advent-of-code/blob/master/src/advent_of_code/2023/day_19_parts.clj.
well that was interesting. I really have to make sure I know where Iβm going before I start coding π
https://github.com/bhauman/adv2023/blob/main/src/adv2023/day19/sol.clj
Here's https://github.com/alexalemi/advent/blob/main/2023/clojure/p19.clj. Today's puzzle was my favorite so far. Part 2 throws us for a loop, and one that requires implementing something nontrivial, but I didn't feel as though it was too impossible to work out how to do it from scratch. It didn't feel like you needed some prior math knowledge or experience to solve part 2, you could just sorta noodle it out for yourself.
my solution is very similar, however it took me some time to figure out the off-by-one errors (top of range is 4001 vs 4000, etc.) https://github.com/erdos/advent-of-code/blob/master/2023/day19.clj