Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
AdventOfCode2022
Solutions to all 25 Advent of Code 2022 in Rust 🦀 Less than 100 lines per day, total runtime of less than 1 second. (by AxlLind)
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
AdventOfCode
Hacky solutions for [Advent of Code](https://adventofcode.com), working on past problems (by AllanTaylor314)
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
-
adventofcode
This repo is designed to keep track of my attempts at advent of code. Starting with 2021, might try earlier years (by ClementPinard)
-
adventofcode
My solutions for https://adventofcode.com/ programming mini puzzles - written mostly as sjasmplus script (to exercise the tool and collect ideas for future development of the script language, not because it's a best choice for the task, quite opposite) (by ped7g)
-
Advent_of_Code
A repo revolving around attempting to solve the Advent of Code puzzles with single-statement t-sql (by adimcohen)
-
advent-of-code-go
All 8 years of adventofcode.com solutions in Go/Golang; 2015 2016 2017 2018 2019 2020 2021 2022
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
JavaScript/TypeScript - Plain JavaScript/TypeScript, "undefined" was never so useful in life.
github
Github
Maple 1185/177
Elixir 666 / 375
Link to full solution
Python, 115/167 part1: just calculation in a while loop using try/except, part2 - binary search
Python+sympy [204/1353]
Typescript / node.js, 1178/370, Code
GitHub link
For part one, I noticed the input being almost valid Elm code, so I wrote a few lines of Fish to generate an Elm program. Then ran it with elm repl. Elm allows out of order variable declarations so it did all the work for me.
For part one, I noticed the input being almost valid Elm code, so I wrote a few lines of Fish to generate an Elm program. Then ran it with elm repl. Elm allows out of order variable declarations so it did all the work for me.
python using z3
Ruby 540/1917
Part 1 : Iterate over all nodes, solving for those for which we know their children already.
Rust (code) 1352/2031 In retrospect I had no chance of solving it the fastest because I basically rolled my own algebra solver instead of pasting it into a solver like Mathematica or computer algebra library.
(Full at https://github.com/petertseng/adventofcode-rb-2022/blob/master/21_monkey_math.rb)
(Full at https://github.com/petertseng/adventofcode-hs-2022/blob/master/bin/21_monkey_math.hs)
Solution in C++ https://github.com/oginer/AdventOfCode2022/blob/master/Puzzle-21/Puzzle-21.cpp
this was the approach I took too, in my Elixir code. https://github.com/sevenseacat/advent_of_code/blob/main/lib/y2022/day21.ex
My Scala solution – to be cleaned up.
Golang, https://github.com/Olegas/advent-of-code-2022/blob/main/cmd/day21/day21.go
Python, Part 1, Part 2
Python
Python
C# , around 200 µs each part
Elixir 2506/3402 (24 minutes, 2 hours), code, thoughts
Python
Part 1
Javascript
C++
Noulith 24/22
C++
Go
Golang Monkey Resolver doing reverse calculation for the humn tree rather than brute forcing a solution.
My solution for reference: https://github.com/brunal/advent-of-code-2021/blob/main/2022/21.lisp
Rust (5902/5411)
done :-)Python
This is probably just because I have a background in optimization methods, but I found this one pretty straightforward: Python
Code on GitHub
Ruby, runs in <4ms
Kotlin
part_1
Elixir
Python AND Js https://github.com/Phil-DS/AdventOfCode2022/tree/master/day21 Started in Python, but felt that JS's better object manipulation was nicer for part 1. Saw part 2 and realized that Python's Complex numbers would be really useful here, as it allows algebra, so rewrote everything back to python, set 'humn' to 1j and just got the names of the functions in 'root'. Really nice, and nearly went with a tree to solve the 2nd part XD
Could anyone help me with todays task. I cannot find what is wrong. My code is here
Runs in about 1 second for all parts. https://github.com/chrisleow/advent-of-code/blob/main/2022/src/Day21.kt
Rust
Python
Github link
Haskell
Rust
Solution to both parts
Didn't seem worth it to me to build a tree, I just use a dict of not-yet calculated expressions and kept churning through it evaluating anything I could until it was done. Seems fast enough. The second part has three variants for each monkey depending which value is missing. Also a chance to be a bit cutesy with sets and the live nature of `dict.keys()`. https://github.com/kupuguy/aoc2022/blob/main/day21-monkey-math.ipynb
Prolog
Github
Simple python solution
Rust
Ruby solution I started by trying to write a treetop parser (again) to explain how this works to some friends... And skipped to problem as soon as I saw my time limit approaching.
My rust code (43mn for part 1 ; +1h33 for part 2) with a topological sort thanks to the crate petgraph.
TypeScript
I did it hooray! Kotlin
did haskell as well (github), but kind of rewrote the `eval` part to include reverse-mathing the unknown part, i like your solver-building much more :-)
Here's the (awful) code (it was less awful at the beginning when I didn't have to shrink everything to struct arrays with members have multiple purposes)
Part1 was happy camping - Diff here
"Works" though I'm thinking there may be a bug since it shows more than one answer satisfies the Monkey Math. Full code is available on github here Day 21 CPP Solution
Playing with expressions in C# (Part 1, Part 2)
Java
sed to generate a Jsonnet program for part 1:
Rust
I made a recursive Expr enum to hold all the expressions and then a hashmap of monkey_name to Expr to link them. Initially I had a very clumsy parser for the input, but I want to learn to drive nom. So after everything worked, I came back and rewrote the parser using nom. It's certainly more flexible, but it's more complicated and possibly slower. I managed to grok it mostly now. Makes me yearn for python, though.
I used the yaah AoC crate this year for boilerplate stuff. Not bad, but the documentation was a little scattered. I managed to make it work, and it's been really helpful.
Github
Racket to generate Racket and Rosette files
Rust
C#:
github
In the end I used Z3 Julia bindings instead. The hardest part was to get the result back from it, because I kept running into assertion violations from inside Z3
[Full writeup on my blog]https://work.njae.me.uk/2022/12/21/advent-of-code-2022-day-21/) and code on Gitlab
part 1 done with recursion
Day21.java: Java 19 with preview features enabled, which allows for pattern matching in switch for sealed types and records (i.e. sum types and product types) – perfect for problems like this, see the equation solver.
go/golang Code
Part 1 (3 lines): https://github.com/bokner/advent_2022/blob/main/day21/part1.sh Part 2 (15 lines): https://github.com/bokner/advent_2022/blob/main/day21/part2.sh