-
Interesting approach. I guess mine could be considered a bit nicer, doing it recursively and returning the number to add to the left or right.
-
Scout Monitoring
Free Django app performance insights with Scout Monitoring. Get Scout setup in minutes, and let us sweat the small stuff. A couple lines in settings.py is all you need to start monitoring your apps. Sign up for our free tier today.
-
Wow! It'is almost exaclty my solution! :) https://github.com/xoposhiy/aoc/blob/main/2021/18.py
-
I wasted a lot of time creating a solution with a proper object model for SFNumber, with recursive SFNParts and all, but I couldn't figure out how to do the explosion β finding the numbers βto the left/rightβ was too hard.
-
Here's my previous solution, which didn't use any mutation: https://github.com/danvk/aoc2021/blob/92b5352806e0e854ebc36e6c9804dc13b5262349/day18/day18.go
-
AdventOfCode
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA
46/40. Python
-
Python 32/30
-
Code and transformed input
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
Python, didn't leaderboard. Cleaned up code for part 1 and part 2.
-
My solution
-
-
github solution
-
-
Perl
-
-
-
Python - github
-
Haskell
-
-
Advent-Of-Code-2021
My solutions to the Advent Of Code 2021. Uploaded the day after each challenge. (by C2thehris)
JavaScript
-
-
I also really enjoyed today's problem from a "way the code feels" perspective. I, too, went the Enum route, with nom for the parsing. My part 2 runtime is 5 ms (which is one of the worst so far this AOC), though I "cheated" with a parallel iterators. I think I have some unnecessary clones, so I guess I'll look to clean that up at some point.
-
Part 1 Part 2
-
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
My Scala solution.
-
C# since I don't see one posted here yet: https://github.com/LEPT0N/toybox/commit/b51ff07fc137c3e23c6b456bd5cbbcf9f744f366
-
Elixir 934/972 ; 5ms/100ms
-
Raku 1918/1873 at 2:23 and 2:31, which is my best score since day 1, despite taking ~20 times as long :-)
-
Mostly a mess of pattern matching. I really need to make some generic tree utilities. Haven't been able to find a decent parser combinator that works in Scala 3 (I usually use fastparse which depends heavily on Scala 2 macros, and scala-parser-combinators works in Scala 3, but I've had a lot of trouble getting it to not be too greedy), so I used the state monad from cats to parse at the bottom of the file, which I think turned out fairly nice.
-
Scala Parser Combinators
simple combinator-based parsing for Scala. formerly part of the Scala standard library, now a separate community-maintained module
Mostly a mess of pattern matching. I really need to make some generic tree utilities. Haven't been able to find a decent parser combinator that works in Scala 3 (I usually use fastparse which depends heavily on Scala 2 macros, and scala-parser-combinators works in Scala 3, but I've had a lot of trouble getting it to not be too greedy), so I used the state monad from cats to parse at the bottom of the file, which I think turned out fairly nice.
-
-
A pretty straightforward binary tree-based implementation: https://gitlab.com/dos1/aoc21/-/blob/main/day18.py
-
Original
-
AdventOfCode
Hacky solutions for [Advent of Code](https://adventofcode.com), working on past problems (by AllanTaylor314)
Python 3
-
Link to code
-
-
-
-
-
github
-
Python 3.8+
-
Go
-
Haskell Kotlin 622/1185
-
-
-
Swift
-
-
-
-
Rust
-
What a headache
-
Snailfish and Reducing/Exploding/Splitting
-
-
Code
-
Python 3. 3 takes today: 1 using nasty string replacements, 1 using a "class Node" style implementation of a binary tree, and finally just deciding to go with a dictionary mapping leaf node positions to their values; point being that in-order traversal comes for free, and the operations to be implemented all end up reasonably simple.
-
Python solution using regex, nothing fancy but it works
-
At first, I thought I will be really clever by just keeping numbers as is. Well - nothing of what I did today was clever. So this is my first attempt at part 1-> GitHub link.
-
-
-
List-based solution - runs part 2 in 2s.
-
Python + Regex Magic: https://github.com/TynanWilke/AdventOfCode2021/blob/main/18/explode1.py https://github.com/TynanWilke/AdventOfCode2021/blob/main/18/explode2.py
-
Pascal - Github
-
github
-
-
-
Python 3 Readable Binary Search Tree Implementation
-
-
Full program on GitHub.
-
I did something super similar, except initially I only kept track of opening brackets. It actually worked really well but the code is much simpler if I also track the closing brackets. Takes around 7.5ms for both parts on my machine. https://github.com/mgoszcz2/adventofcode/blob/master/2021/src/day18.rs
-
TypeScript, Worked with a flat structure which tracks [value, depth], taking about 200ms to solve part 1 and part 2 for test and actual input.
-
Rust
-
-
F# solution in Jupyter Notebook. Thank God for the Haskell programmers! I would not have been able to solve this without peeking at their some of their code. Parsing the input string was just the first of the challenges! I envy those dynamic programming languages with an eval function.
-
Advent-of-Code-2021
Made it through all 25 days of Advent of Code for the second time! (by Leftfish)
As a complete hobbyist, I was glad I figured out this had something to do with binary trees. It took about an hour to design everything on paper. Then I started to code it...and then debug...and four hours later I finally arrived at this solution.
-
Python (using regex)
-
-
C# 3406/9233 :oof:
-
-
Wrt. parsing, my AOC-experience is that rust works really well with recursive descent parsers probably because of the combination of native slices and enum returns. You can use parser combinators like nom, but with Context for error handling it is often just as concise to do without. This is what I had for parser today:
-
My rust solution
-
Python
-
-
Part 1
-
github
-
Clojure. GitHub.
-
-
-
Github
-
-
-
-
-
Python using a graph of nodes.
-
Python
-
-
-
Python
-
Rust
-
Common Lisp Truly ugly day, took me about 4 hours for part 1 and submitted more than 24h past the puzzle for the first :(
-
Rust GitHub. This took me much longer that I care to admit. I started with a tree-based solution, tried a list, went back to tree and the back to the list again...
-
-
Python 3
-
-
-
-
-
-
Bonus: Helper function to build the binary tree
-
GitHub
-
I managed after a very long time to solve it with a class structure. Not the nicest code, but it was a lot of fun. Also visualizing and scribbling multiple trees was definitely needed and also a lot of fun. Here's my code
-
Great solution. I was tired and stuck today so I decided to skimp and well, let's say let your solution inspire me. I did make one change though - using the experimental box pattern feature, it is possible to get around some of the matching gore in `explode`. In case you are interested, here's the commit with only those changes: https://github.com/barafael/aoc-2021/commit/049ae76a3493cfa7d7813d3e057c0e06c09cc90f
-
-
I spent a long time on this on Sunday but really enjoyed it. I've linked the code for the day above but I've split off the library functions into my general AoC repository, they're in zipper.lisp maybe.lisp and a couple of functions in monad.lisp.
-
adventofcode
My collection of Advent of Code solutions in a slightly overkill project setup ππ» (by marcelblijleven)
My solution for today: https://github.com/marcelblijleven/adventofcode/blob/master/src/adventofcode/year_2021/day_18_2021.py
-
advent-of-code-go
All 9 years of adventofcode.com solutions in Go/Golang; 2015 2016 2017 2018 2019 2020 2021 2022 2023
-
Otherwise, the main way I solved this was with a flat list of tokens rather than a truly nested structure. This was very similar to last year's Day 18, which I also solved in a similar manner.
-
advent-of-code-2021
My Advent of Code solutions. I prioritize readability over performance where possible. (by elliott-with-the-longest-name-on-github)
-
Parsed the input into an object tree. Wrote a lot of tests.
-
-
-
Go, 19196/19041
-
I am pretty satisfied with my solution to this problem even though there is some optimization potential left on the table - it solves the puzzle in 500 ms on my MB pro.
-
-
Solution
-
Golang: https://github.com/Resisty/advent2021/blob/main/cmd/day18/day18.go
-
Kotlin - I went with solving it in place ( sort of, I had to replace [ ] with ( ) because of the way I stored the numbers ). My first day attempt of it I tried to do it with binary tree, but I'm just not familiar enough with the subject to do it that way and I failed miserably ( I'm studying the subject now, as I think it will be helpful with future code challenges ). So my next day attempt I figured I'd try solving it in place and everything worked out really well ( solved it yesterday, but wanted today to review my code before submitting it ).
-
advent-of-code
Synergy Codes' developers and their attempts to solve "Advent of Code" riddles (by synergycodes)
Full code
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives