-๐ŸŽ„- 2020 Day 23 Solutions -๐ŸŽ„-

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

Our great sponsors
  • OPS - Build and Run Open Source Unikernels
  • Scout APM - Less time debugging, more time building
  • SonarQube - Static code analysis for 29 languages.
  • advent-of-code

    My solutions for Advent of Code (by AlexAegis)

    TypeScript

  • aoc2020

    Advent of Code 2020 - my answers

    Haskell

  • OPS

    OPS - Build and Run Open Source Unikernels. Quickly and easily build and deploy open source unikernels in tens of seconds. Deploy in any language to any cloud.

  • Advent_of_Code_in_Pascal

    My solutions to the Advent of Code, in Free Pascal

    Pascal - runs part 2 in 0.248 seconds on my laptop.

  • aoc-clojure

    Advent of code 2020 solutions in Clojure

    They're not; line 20 is computing a mapping from cup to next cup, and they're using that to look the destination up on line 30. So this is already using direct lookups on a hashmap.

  • advent-of-code

    Solutions to Advent of Code puzzles. (by bsamseth)

    Took a while to come up with a data structure that would make the moves efficiently. After a bit of thought today I realized I could use a (single) linked list with a dictionary from cup label to list node. Code: github (v1) runs in < 15 seconds on my machine.

  • AdventOfCode

    My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA (by jonathanpaulson)

    Updated my code to use an array of "next" pointers (as some other folks here suggest) and it's like half as long.New code: https://github.com/jonathanpaulson/AdventOfCode/blob/master/2020/23.py

  • advent2020

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

    Current code, comfortably within the 250 ms limit. Data structure is just a permutation (which is much the same thing as a circular singly-linked list but there's no need for any per-node data). I did peek, though.

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and ๏ปฟexternal services monitoring, Scout is a developer's best friend when it comes to application development.

  • hello-world

    Innocent first test.

    Racket, part 2

  • Golang 925 / 299

  • aoc2020

    Advent Of Code 2020 solutions (by constb)

    part 1 part 2

  • adventofcode

    My AdventOfCode implementations (by nielsutrecht)

    This one was interesting! Part 1 wasn't too hard aside from me mucking about with a data structure I created pretty poorly. Then when part 2 unlocked I found out that the part 1 solution would take about 60 hours to find a solution :D So back to the drawing board. I had to implement a data structure (referenced in the code) from scratch :D

  • intcode

    Java ~2s to run.

  • advent-of-code-2020

    Answers and solutions for Advent of Code 2020. (by Bruception)

    Python3 - solution using a circular linked list + hash map.

  • advent2020

    Advent of Code 2020 solutions in Python (by jeslinmx)

    Python 3.8.

  • For part two, I first tried rewriting my code with a circular list structure I wrote for Advent of Code 2018 day 9 (Marble Mania). I figured the mutable circular list implementation would be more performant. It was, but nowhere near enough.

  • aoc-2020

    Advent of code 2020 in Python and Rust (by TamTran72111)

    My Python and Rust solutions run in 10s and 250ms respectively. Do you guys know how to improve the performance for the Python version?

  • aoc2020

    Python Solution parts 1 and 2

  • adventofcode

    https://adventofcode.com (by jbaldwin)

    C++ Part1 and Part2

  • advent-of-code-2020

    My solutions for Advent of Code for 2020, done in Python 3. https://adventofcode.com/2020 (by BradonZhang)

    Python (1026/63)

  • adventofcode

    ๐ŸŽ„ My Advent of Code solutions. Often done with unfamiliar languages so don't expect idiomatic code. (by dmshvetsov)

    part 1 https://github.com/dmshvetsov/adventofcode/blob/master/2020/23/1.rb (rank 3504)

  • AdventOfCodeCSharp

    My AoC Solutions

    C# https://github.com/Bpendragon/AdventOfCodeCSharp/blob/master/AdventOfCode/Solutions/Year2020/Day23-Solution.cs

  • advent

    Advent of Code monorepo (by thejchap)

    python - circular linked list/dict

  • adventofcode

    Advent of code in rust (by Japanuspus)

    My thoughts exactly. But after the initial dread, I just used a vector and used indexes into that as pointers. Think this is sort of a general rust pattern (https://github.com/Japanuspus/adventofcode/blob/master/2020/day23/src/main.rs).

  • advent-of-code

    ๐ŸŽ„ Solutions to Advent of Code challenges (by sanderploegsma)

    F#

  • aoc

    advent of code (by apparentorder)

  • aoc2020

    Advent of Code 2020, while learning Scala (by grey-area)

    Two solutions to part 2 in Scala, using a hash map and a vector respectively to implement a linked list / permutation.

  • AoC2020

    Programs for Advent of Code 2020 (by Perska)

    C# LinkedSolution

  • advent-of-code-2020

    โ˜ƒ๏ธ๐ŸŽ„๐Ÿ‘จโ€๐Ÿ’ป Solving Advent of Code 2020 in Rust ๐Ÿฆ€ (by TheLartians)

    After spending way too much time trying to implement a circular linked list in Rust (and figuring out why that is a bad idea), I realised we only need to store the next value for every cup. After that part 2 was quite straightforward. (part 1)

  • comp_prog

    My solutions to competitive programming problems

    Python3 solutions on GitHub.

  • hac

    HAC Ada Compiler - a small, quick Ada compiler fully in Ada

    Code available here.

  • Advent-of-Code

    Advent of Code (by michaeljgallagher)

    Linked lists! Still took me a bit to implement though. I'll try to clean this up a bit

  • cuddly-octo-palm-tree

    Random stuff that isn't really worth its own repo

    If you really want speed, you'll need to drop to Java arrays. Overall, your approach is based on a map from cup value (a long) to next cup value (a long). Clojure maps are great for many things, but if you need a fast representation of a mapping from integer to integer, the best option is a Java array. For me, switching from a map-based implementation to an array-based one reduced the time it take for part 2 from ~48s to ~4s.

  • advent-of-code

    My solutions for Advent of Code (by besasam)

    Python - I'm so glad I finally got this! There were some very helpful comments about today's Part 2 on this sub that helped me get on the right track. You can sorta see my process with list slicing at first which worked fine for Part 1, and then moving on to a linked list for Part 2. Takes a little under 35s to execute, which is abysmal, but I showed the crab who's boss and don't really feel the need to mess with it any more lol.

  • advent-of-code-swift

    Puzzle Solutions in Swift for Advent of Code

    Nice! I struggled with the performance of my Swift solution. I thought the problem was that my huge nextCup array was getting copied every time I updated it due to Swift's copy-on-write. I worked around it by making it an array of integer references which can mutate without triggering the array's copy-on-write process. This helped a lot, but it still takes >30s to complete. ๐Ÿ˜ฌ

  • AoC-2020-solutions

    My Python solutions to Advent of Code 2020! (by womogenes)

    Code (Python) I brute forced part 1, used a linked list stored in an array.

  • AdventOfCode2020

    Javascript Day 23 part 1 and 2

  • aoc20

    For those interested: Numba guide; my code (updated).

  • aoc2020

    Advent of Code 2020 (by ednl)

    Yes, definitely don't create a list for every pick up. No need to insert and delete if you use an array as a linked list. My code: https://github.com/ednl/aoc2020/blob/main/day23.py

  • advent_2020

    Advent of code 2020 [Moved to: https://github.com/mattteochen/AoC]

    both

  • aoc2020

    Advent of Code 2020 solutions (by sharpobject)

    Lua 44/49

  • adventofcode

    Python 3

  • AOC2020

    My solutions for the AOC (by MatthiasCoppens)

    Haskell, takes about a minute to run on my old laptop, presumably due to the high memory usage.

  • AOC2020

    Link to CircleLinkedSet on Github

  • advent-of-code-2020

    Solutions for the 2020 Advent of Code (https://adventofcode.com/2020) (by rujames)

    For me, switching from shuffling vectors / lists to updating an array took it from never going to finish to about 10 minutes, which is dishearteningly still 150x slower than yours. ๐Ÿ˜ฉ

  • snippets

    Here's my somewhat slow solution in Python3

  • advent-of-code-wim

    Wim's solutions for https://adventofcode.com/ puzzles

    My Python solution is under 2 seconds on pypy3 (macbook air). It's still about ~10 seconds on CPython though. https://github.com/wimglenn/advent-of-code-wim/blob/master/aoc_wim/aoc2020/q23.py

  • advent-of-code-2020

    Advent Of Code 2020 (by cberigan)

    Singly Linked List and Dictionary Lookup Solution here

  • aoc2020

    Haskell Solutions to Advent of Code 2020 (by haskelling)

    Code Repository: https://github.com/haskelling/aoc2020

  • aoc2020

    Advent of Code 2020 in Rust (by Lakret)

    Solution: part 1, part 2.

  • advent-of-code-2020

    Source code for my solution to 2020's Advent of Code. This year, I'm learning Kotlin! (by richzli)

    Part 1 / Part 2

  • Advent-of-Code

    Code here

  • aoc2020

    Rust 489/629 This was fun. Since linked lists in Rust is a meme, I wound up using an array of next/prev pairs, which worked fine. Unfortunately I burned some time trying to get it to work with std::collections::LinkedList, which wasn't great because I wound up having to scan through the list too many times.

  • advent-of-code-go

    (All 7 years of) adventofcode.com solutions in Go

    Go 1250/199

  • adventofcode-2020

    Solutions for Advent of Code 2020 (by gengkev)

    Python, 116 / 13, code

  • aoc

    Solutions to Advent of Code puzzles in Python. (by seligman)

    github

  • adventofcode

    Solutions for Advent of Code over the years (by sburuiana)

    C++ 557/553

  • aoc2020

    My advent of code 2020 solutions (by A-UNDERSCORE-D)

    Nice you and I did about the same thing! if you're curious, a ring.Ring with Value as an int does not make it any faster. Im sitting at about 3.5s: https://github.com/A-UNDERSCORE-D/aoc2020/blob/main/2020/23/solution.go

  • Advent-of-Code

    ๐ŸŽ„ My Advent of Code solutions ๐ŸŽ„ (by 89netraM)

    Part 1 Part 2

  • advent-of-code-2020

    Python 3 (permalink)

  • Advent2020

    Python 3 2576/1581 (yes, I know, nothing to brag about)

  • advent-of-code-2020

    ASCII art of digits that also happen to solve Advent of Code challenges (by arknave)

    Python (19/133), C

  • patricia

    Garbage collector-sensitive patricia tree for IP/CIDR tagging

    Go's deficiencies actually pointed me to a faster solution here. From the readme of kentik/patricia (an optimized radix tree for storing IP addresses), emphasis mine:

  • advent2020

    https://adventofcode.com/2020 (by pvillano)

    Python, (optimized) runs in .2 seconds on pypy

  • aoc-2020

    My solutions to Advent of Code 2020. (by Fryer)

    JavaScript 3234/2003

  • AoC

    my personal repo for the advent of code yearly challenge (by Fadi88)

    python

  • aoc2020apl

    Advent of Code 2020 solutions in Dyalog APL

    Thanks. "Dyalog APL" in each post links to my repo.

  • aoc-2020

    Javascript solution

  • adventofcode

    Advent of code (by Peter554)

    golang

  • adventofcode_2020

    C++

  • AdventOfCode2020

    Advent of Code 2020 (by diccy)

    https://github.com/diccy/AdventOfCode2020/blob/master/d23.py Same in Python... but runs in 12 seconds :'D

  • advent-2020

    ๐ŸŽ„ Advent of Code 2020: Solutions in R (by fdlk)

    I don't think it's in the array access but in the moving stuff around. I used a vector where a[[i]] contains the label of the label of the cup next to the cup with label i. Twenty seconds

  • Advent-of-Code

    Solutions to Advent of Code challenges (by StasDeep)

    Python (23 sloc. CAUTION: walrus operators!)

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