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
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
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
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #performance










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.