-🎄- 2021 Day 21 Solutions -🎄-

This page summarizes the projects mentioned and recommended in the original post on /r/adventofcode

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • roast

    🦋 Raku test suite

    It's convoluted and there are way cleaner solutions based on recursion and memoization; the only merit is probably that it's a bit more efficient (in Raku, at least, compared to the re-implementation of this Python solution).

  • adventofcode

    Solutions for problems from AdventOfCode.com (by bhosale-ajay)

    F#, Under 60 lines, readable code, takes about 200ms (for both the parts) , Learned about flag #nowarn "40" to achieve true memorization.

  • 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

    Advent of Code solutions (by mcpower)

    Python, 198/34. Part 1, part 2 is below as it's mostly self-contained.

  • aoc-2020

    Awful code that implements the challenges from https://adventofcode.com/2020/ (by Heleor)

  • advent_of_code

    perl5 62/702

  • adventofcode

    Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)

    My Scala solution.

  • Advent-of-Code

    Advent of Code (by michaeljgallagher)

    Yay memoization!

  • 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.

  • Advent-of-Code-2021

    Advent of Code solutions (or failures) for 2021 (by phord)

    GitHub

  • advent2021

    Mine, Python 3.10.

  • adventofcode

    Advent of Code challenge solutions (by flwyd)

    Raku 3364/1406. Memoization cached 22828 trees, saving 135153328222302 wins for part 2, so it ran in less than half a minute, which is a big improvement over the last two days.

  • aoc-2021

    Javascript with a non-dp approach and no memoization. Recursions go brr!

  • deno_aoc

    🎄 Advent of code solutions written in TypeScript for Deno.

  • aoc2021

  • AdventOfCodeCSharp

    My AoC Solutions

    Code On Github

  • AdventOfCode2021FSharp

    Solutions for Advent of Code 2021 in F#

    F# solution in Jupyter Notebook. Got some help from this thread.

  • aoc2021-rust

    Advent of Code 2021 - Written in Rust (by dclamage)

    Full Source

  • AdventOfCode2021

    Advent of Code for 2021, which I used to learn rust (by gralamin)

    Rust

  • aoc2021

    Advent of Code 2021 - my answers

    I'm doing the same cached recursion in Kotlin, Python, and Rust.

  • Advent2021

    Advent of Code 2021 Solutions, in Zig

  • advent-of-code

    Python. Part a is whatever, part 2 is pretty clean. I wonder if there's a math-only solution to this?

  • aoc2021

    solutions for advent of code 2021 (by tumdum)

    Thanks! In the meantime, I was able to slash the runtime in half by using a faster hash (fxhash) for the cache.

  • Advent_of_Code2021

    Solutions to Advent of COde 2021 (by cettt)

    Today was my cheatday as I used the tidyverse library :) github

  • advent2021

    Advent of Code 2020 solutions in C++ (by bustercopley)

    C++ 5173/3650

  • AdventOfCode2021

    Advent of code 2021 (by marcodelmastro)

  • aoc2021

    Advent of Code 2021 solutions (by kupuguy)

    Python solution. https://github.com/kupuguy/aoc2021/blob/main/src/day21.py

  • Advent_of_Code_in_Pascal

    My solutions to the Advent of Code, in Free Pascal

    Pascal 2235/4609

  • AOC

    Advent of code (by cascer1)

    source

  • aoc21

  • advent-of-code-2021

    Discontinued Code I used for solving https://adventofcode.com/2021 (by pavel1269)

  • memoize

    A method caching macro for elixir using CAS on ETS. (by melpon)

    For p1 used streams to imitate infinite dice rolls. For p2 had to refactor to be able to cache effectively using Memoize. Finishes in ~500ms.

  • aoc2021

    Full code is here: Github

  • advent2021

  • advent2021

    Advent of Code 2021 (by arjanIng)

    Java

  • advent2021

    Advent of Code 2021 (by moink)

    Extrapolation code

  • aoc2021

    Advent of Code 2021 (Elixir + Pygame) (by p88h)

    Elixir, 167 ms on Part 2.

  • aoc2021

    Wow. Almost identical to my solution! https://gitlab.com/RedPixel/aoc2021/-/blob/main/day21/day21b.py

  • aoc2021

    Python implementations for Advent of Code 2021 (by yoshivda)

    Python, part 2 runs in ~0.3 seconds.

  • advent-of-code-2021

    Advent of Code 2021 Solutions (by jerchende)

    Part1 was quite easy, so i created a Dice and Player object, which are able to roll und move.

  • Advent_Of_Code

    My solution for the Advent of Code challenges in various languages. (by Dullstar)

    C++

  • advent-of-code

  • advent-2021

    Discontinued [Moved to: https://github.com/Crazytieguy/advent-of-code] (by Crazytieguy)

  • aoc-2021

    Advent of Code (AoC) 2021 solutions (by egel-lang)

    task 2, and with colors, with impure memoization. spend most time figuring out generators

  • AOC

  • advent-of-code-2021

    learning Rust (by nj-vs-vh)

    Rust: https://github.com/nj-vs-vh/advent-of-code-2021/blob/main/src/day21.rs At first I misread the second part and forgot that dice are thrown more than opce... Banged my head against the wall trying to figure out some clever way to iterate through possible move combinations. Also got sidetracked trying to solve the whole thing modulo 10. When I finally understood triple dice throw, it became feasible to brute-force the puzzle for distinct move values while keeping track of the number of universes this happens in. It's not too elegant but works in 2.5 seconds.

  • full code with part 1 I used a State monad for part 1 just as a refresher.

  • advent-of-code

    My solutions to the Advent of Code (by aaronreidsmith)

    Scala. Doesn't have the convenience of functools.cache like Python, but you can get the same behavior using a mutable.Map and using .getOrElseUpdate!

  • advent-of-code

    In Common Lisp (by brunal)

  • aoc2021

    Advent of Code 2021, this time in Go (by danvk)

  • advent-of-code-2021

    zig solutions to advent of code 2021 (by jchevertonwynne)

  • AdventOfCode2021

    Advent of Code 2021 Puzzles (by rdi-caveman)

  • advent-of-code-2021

    All solutions for the 2021 Advent of Code event. (by Bruception)

  • aoc2021

    Advent of Code 2021 on my homemade 16-bit CPU SCAMP (by jes)

  • aoc-2021

    Advent Of Code 2021 (Solutions) (by codemonkey-uk)

  • adventofcode

    🎅 Repo where anyone can solve puzzles from adventofcode.com (by kolonialno)

    This is my fast and final approach btw https://github.com/kolonialno/adventofcode/blob/main/matsemann/Day21.kt

  • aoc

    Advent of Code Solutions (by joeyemerson)

  • AdventOfCode

    Advent of Code Solutions (by auxym)

  • memo

    Memoization for Nim (by andreaferretti)

    Thanks goes to andreaferretti's memo library, too!

  • AdventOfCode2021

    Solutions for Advent of Code 2021 (by fulee85)

  • adventofcode

    Advent of code solutions (by mathsaey)

  • advent-of-code

    My Advent of Code answers (by tcsullivan)

    Clojure (GitHub). I see some elegance in my part 1 solution, but sadly it was entirely inadequate for part 2 :(

  • aoc2021

  • aoc

    Not sure if you are open to any tips about slightly improving speed, but our part twos are really similar.

  • aoc.ex

  • aoc

    Advent of Code 2020 in Nelua (by edubart)

  • aoc

    Advent of Code - mscha's Perl 6 solutions (by mscha)

    Completed part 2, see GitHub. I couldn't really use the same `DiracDice` class and simply use another `Die`, but had to create a separate `DiracDice2` class.Basically, just keep track of the possible universe state and their counts, and try all possible combinations of die rolls. Keep playing until all universes have a winner.

  • AdventOfCode2021

  • advent-of-code

    Advent of Code solutions in JS (by leyanlo)

  • advent-of-code-kotlin-2021

    My solution attempts to Advent of Code 2021

  • advent-2021-nrsherr2

    nrsherr2 Advent of Code 2021

  • AdventOfCode

    Sharing Advent of Code Exercises (by shouchen)

  • adventofcode2021

    Advent of Code 2021 (by r0f1)

    Misunderstood part 2 at first but I knew it would be a dynamic programming thing simply based on the task itself. This let me eventually clear up my misunderstanding. Had an ugly solution where I always switch between player 1 and 2 based on a toggle, and then saw this beauty so I that clever switching as well.

  • advent-2021

  • aoc2021

    Advent of Code 2021 (by TheJare)

  • adventchallenge

    Straight forward (=not optimized) solution that takes ~10 seconds to run. https://github.com/christianfalck/adventchallenge/blob/main/AdventOfCode/Day21.cs

  • advent_of_code_2021

    Golang solutions to advent of code 2021 (by Stefansfrank)

    Part1 was so simple that it's not worth talking much about it. My solution to Part2 is:

  • aoc-21

    Advent of Code 2021

    C++ 17 solution, part 1 & part 2 run at 129ms [Github](https://github.com/giorgosioak/aoc-21/tree/main/21)

  • AdventOfCode

    My Rust solution: https://github.com/CastleQuirm/AdventOfCode/blob/main/year21/src/day21.rs

  • adventofcode2021

    My Solution to AOC2021 (by HrRodan)

  • advent-of-code-go

    All 8 years of adventofcode.com solutions in Go/Golang; 2015 2016 2017 2018 2019 2020 2021 2022

  • aoc2021

    Advent of code 2021 (by pbruyninckx)

    github: Part 1 This felt rather easy, so I tried to write things in a nice way, hoping it wouldn't be too challenging to extend. I'm reasonable happy with how the code looks, but the extensibility was definitely missing.

  • AoC2021

    Part 2, on the other hand, was more much complicated. I noticed beforehand that it was unfeasible to simulate every last of the trillions of possibilities, that it was necessary to keep track of the win counters in some other form. But I could not figure out initially how to do it. I looked this thread for ideas, and managed to understand the strategy. Credits go to u/SwampThingTom for the idea ([this comment](SwampThingTom), and the code behind it). After understanding the approach, I implemented it on my code (instead of copy/pasting).

  • AOC2021

    Advent of code solutions 2021 (by calebwilson706)

    Kotlin

  • AdventOfCode2021

    My solutions to https://adventofcode.com/2021 (by willkill07)

  • aoc2021

    Chez Scheme (Part 2)

  • aoc2021

    Advent of Code 2021 solutions in Clojure and Python (by tabidots)

    Clojure (GitHub). 3 seconds. Well, I tell myself I'd rather write readable code than super-concise code, anyway.

  • adventofcode

    https://adventofcode.com/2021/ (by Torakushi)

  • aoc-2021

  • adventofcode

    Solutions to Advent of Code in Go (by 1e9y)

  • AdventOfCode2021.jl

    Advent of Code 2021 in Julia

  • R

  • Advent_of_Code

    My Advent of Code solutions. (by Farbfetzen)

    My solutution in Python. Using itertools.cycle for part 1 and functools.cache for part 2.

  • advent-of-code-2021

    My solutions for the https://adventofcode.com puzzles (2021) 🎄🎅 (by ClouddJR)

    Kotlin

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts