lud
A rather verbose solution but simple enough I guess.
https://github.com/lud/adventofcode/blob/main/lib/solutions/2023/day19.ex
Trending in Challenges
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
igorb
My approach today:
https://github.com/ibarakaiev/advent-of-code-2023/blob/main/lib/advent_of_code/day_19.ex
Part 1 is basically just a loop navigating over the map.
Part 2 is building a “binary tree”: if a certain condition is true, the next execution is a branch “to the left” with the target workflow; if it’s false, continue with the next step of the current workflow. I maintain a map of ranges (
%{x: {1, 4000}, ...}) throughout and adjust the range based on each condition. If the execution is to the “left” of the tree, then I just apply the condition, otherwise I apply the inverse of the condition. When A is reached, I multiply the ranges.tywhisky
https://github.com/tywhisky/advent-of-code/blob/master/2023/day_19/solution.exs
For part2 I used MapSet.intersection/2, which didn’t perform very well, but the whole coding experience was very smooth, no debugging, and I got the right results in one go. The idea is also very easy to understand.
bjorng
Here is my solution:
https://github.com/bjorng/advent-of-code-2023/blob/main/day19/lib/day19.ex
Aetherus
I just can’t understand what Part 2 is talking about
antoine-duchenet
Here’s my solution, it went pretty well !
Inputis just a collection of sigils (such as~i) to manipulate inputs (like returning parts separated by an empty line).lud
Part 2 wants you to count all possible combinations of
x, m, a, s(between 1 and 4000) that would be accepted by the workflows.So basically this:
Aetherus
Thank you for your extremely clear explanation
Finally, I did it!
I just feel today is the GenServer day, so I started a bunch of
GenServerprocesses to handle the situation.All the variable named
xmasin the following code binds to a map that looks likeFirst, here’s the GenServer module that models one pipe in the workflow.
Then there’s a GenServer for accumulating the results:
And the blackhole
Start all the servers:
And finally, do the job
woojiahao
Got to use
Agenttoday, pretty fun day honestly:https://github.com/woojiahao/aoc/blob/main/lib/aoc/y2023/day_19.ex
Part 1 was relatively straightforward, part 2 was a little more challenging in the data storing front, but the actual calculation was quite straightforward
midouest
For Part 2 I first recursively walked the tree from
"in"and built up a list of branches that lead to"A". Then I flattened the conditions in each branch into a ranges by category. Lastly I found the number of permutations of each branch usingEnum.productand summed all of the permutations for each branch. I probably could have combined the first two steps, but I was thinking about the problem as “find all the acceptance branches, then find the number of permutations in each branch”.Part 1
Part 2
rugyoga
A crude parser and two simple interpreters.
For part 2 used xmas map holding ranges,
and some simple recursion.