-🎄- 2021 Day 9 Solutions -🎄-

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

Judoscale - Save 47% on cloud hosting with autoscaling that just works
Judoscale integrates with Django, FastAPI, Celery, and RQ to make autoscaling easy and reliable. Save big, and say goodbye to request timeouts and backed-up task queues.
judoscale.com
featured
InfluxDB high-performance time series database
Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.
influxdata.com
featured
  1. advent-of-code-2021

    Advent of Code 2021 Java 17 (by zebalu)

    If you are using custom Coord objects, you could consider going in and making a map of coord to value. Saves a bunch of boundaries checks, as you can see in zebalu's solution (another comment in thread) https://github.com/zebalu/advent-of-code-2021/blob/master/src/main/java/io/github/zebalu/aoc2021/Day09.java

  2. Judoscale

    Save 47% on cloud hosting with autoscaling that just works. Judoscale integrates with Django, FastAPI, Celery, and RQ to make autoscaling easy and reliable. Save big, and say goodbye to request timeouts and backed-up task queues.

    Judoscale logo
  3. adventofcode

    Solution without cycle and solution with cycle are both at around ~300ms, same plans

  4. adventofcode

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

    F#, learning F#, took some time to implement DFS, but happy with solution.

  5. advent-of-code-2021

    AOC in go (by alextanhongpin)

  6. adventofcode

    Answers to Advent of Code (by viceroypenguin)

  7. AdventOfCode

    python 1016/334

  8. aoc

    My Advent of Code solutions (by vypxl)

    Python 3 668 / 616

  9. InfluxDB

    InfluxDB high-performance time series database. Collect, organize, and act on massive volumes of high-resolution data to power real-time intelligent systems.

    InfluxDB logo
  10. deno_aoc

    🎄 Advent of code solutions written in TypeScript for Deno.

  11. advent-of-code-2021

  12. adventofcode

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

    My Scala solution.

  13. advent-of-code-go

    All 10 years of adventofcode.com solutions in Go/Golang (and a little Python); 2015-2024

  14. AdventOfCode2021

  15. advent-of-code-wim

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

    Python

  16. advent

    Git mirror of https://bitbucket.org/sjl/advent (by sjl)

  17. AdventOfCode

  18. Advent-of-Code

    My solutions or attempts at solutions to the Advent of Code event. (by salt-die)

    Python Using image libraries to not do any real work!

  19. aoc2021

    Advent of Code 2021 Solutions (by nlowe)

    Go, 1730/3574

  20. AdventOfCodeRust2021

    Code related to Advent of Code 2021 using Rust

    Part 1 nested ifs (does it count as "AI"?), Part 2 used DFS based on https://brilliant.org/wiki/depth-first-search-dfs/ solution in rust

  21. AdventOfCode2021

  22. Advent-of-Code

    Advent of Code (by michaeljgallagher)

    Another fun one today!

  23. aoc2021

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

  24. aoc2021

    Discontinued Advent of code 2021 in JS (by TheAngularGuy)

  25. advent-of-code-2021

    Advent of Code 2021 Submissions (by mariotacke)

  26. aoc2021

    Advent of Code 2021 (by Emerald-Element)

    Part 1 solutionPart 2 solution

  27. Advent-of-Code-2021

    Part 1

  28. adventofcode

    Advent of Code solutions (by jjclark1982)

    source code on GitHub as a notebook explaining the technique of using boolean masks with NumPy arrays.

  29. adventofcode-2021

    Here we go again. Let's actually save Christmas this year. (by Riven-Spell)

    That said, Day 9 in Go.

  30. Advent-of-Code-2021

    Advent of Code Solutions 2021 in Python (by DenverCoder1)

  31. advent-of-code

    Common Lisp. Nothing special, just a BFS.

  32. advent-of-code

    Discontinued Solutions for Advent of Code problems in various languages. (by Andrew-William-Smith)

    This was a pretty fun day! I'm very glad that I took the time to write a small utility module for handling multidimensional arrays in Erlang a few days ago: otherwise, trying to wrestle coördinates would have quickly become painful. This was also my first time writing DFS in Erlang; a queue-based tail-recursive approach ended up being much cleaner than a simple recursive approach that used lists:foldl/3 to pass the modified matrix between neighbours. Writing the algorithm both was was definitely a great learning experience though!

  33. aoc2021

    Advent of Code (2021 edition) (by Samplasion)

    TypeScript

  34. AdventOfCode

  35. advent-of-code-solutions

    My JS solutions for https://adventofcode.com/ (by AugustsK)

  36. aoc2021

    solutions for advent of code 2021 (by tumdum)

    my rust day9:

  37. AlgorithmProblems

    Solutions to Algorithm Problems :chart_with_upwards_trend: :neckbeard:

    Did a recursive DFS to solve part 2. github code

  38. aoc

    rust solution part 2 bfs

  39. advent-of-code-2021

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

  40. aoc2021

    Advent of Code 2021 (by sotolf2)

  41. adventofcode

    My AdventOfCode implementations (by nielsutrecht)

    Day9

  42. aoc2021

    Advent of Code - 2021 (by en0)

    Part1

  43. AdventOfCode2021_Julia

    Doing the Advent of Code 2021 challenges live in Julia

    After a bit of cleanup, mine is taking 230µs: https://github.com/MarcusTL12/AdventOfCode2021_Julia/blob/main/src/day9.jl

  44. AdventOfCode-2021

    My solution to AdventOfCode 2021 problems. (by MubeenKodvavi)

    Part1 Part2

  45. aoc2021

  46. adventofcode

    Advent of Code challenge solutions (by flwyd)

    Raku 6832/4872. Despite being a highly-paid software professional I managed to implement three incorrect ways to get the four adjacent grid cells. This is now the second problem this year where I've unnecessarily handled diagonals.

  47. advent_of_code

    All of my :star: Advent of Code solutions - using Elixir (by wasi0013)

    Solved part2 using bfs: y2021/day_09.ex

  48. adventofcode

    ES6 solutions to Advent of Code puzzles. (by surgi1)

  49. aoc

    advent of code (js / deno ts ) (by jackysee)

    ts (deno) https://github.com/jackysee/aoc/blob/main/2021/day9.ts ` import data from './day9_input.ts';

  50. advent-of-code-2021

  51. AoC2021

    Advent of Code 2021 in F# (by kimvais)

    So much more elegant than my solution

  52. advent-of-code

    In Common Lisp (by brunal)

  53. AdventOfCode2021

    Advent of code 2021 (by marcodelmastro)

  54. advent-of-code

    My solutions to advent of code problems (by jtrinklein)

  55. aoc2021

    Advent of code 2021 solutions, in varied languages (by A-UNDERSCORE-D)

    Python source

  56. advent-of-code-2021

  57. AoC

    Advents of Code in NASM x86_64 assembly (by JustinHuPrime)

    Part 1 involved reading the map and searching for low points. I used border cells to avoid having to check boundaries.

  58. AoC

  59. advent-of-code

    Mine runs in 130us (without the time spent in parsing the input) But the time will vary between the machines :)

  60. adventofcode2021

    Discontinued our team's solutions for advent of code 2021 (by northflank)

    Easy to understand JavaScript solution on https://github.com/northflank/adventofcode2021/blob/main/day9.js

  61. AdventOfCode

    Advent of Code Solutions over the years (by tetrisdev)

    Python 3 Ah.. good old recursion in this one :) More a "flow up" than a "flow down". Still learning Python and open to suggestions. Solution A & B

  62. adventofcode

    part1 with window functions: https://explain.dalibo.com/plan/drW

  63. Solution in Python

  64. adventofcode21

    2021 advent of code solutions

    presenting the worst code I have written in my life, including in high school (here, in Ruby)

  65. advent-of-code-kotlin-2021

    My solution attempts to Advent of Code 2021

  66. advent-of-code-2021

  67. AoC

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

    python solutiuon

  68. advent-of-code-koto-2021

    Solving Advent of Code 2021 with Koto

    Solution

  69. advent-of-code

  70. aoc-2021

    Advent of Code 2021 in Rust (by kirillbobyrev)

    My solution in Rust looks rather straightforward: the first part initalizes lower points and then the second runs BFS over them.

  71. advent-of-code

    Advent Of Code Solutions (by sreedevk)

  72. aoc21

    Github

  73. adventofcode

    TypeScript, with a recursive Flood Fill algorithm for part 2: https://github.com/eszpee/adventofcode2021/blob/main/src/day09.ts

  74. Advent-Of-Code

    Today was very enjoyable, albeit a bit easier than expected after what was yesterday, haha. Part1 and part2 in Javascript

  75. aoc2021

    Advent of Code 2021 - my answers

    Haskell 1848/1580

  76. fgl

    A Functional Graph Library for Haskell

    For part 2, instead of trying to union-merge from the lowest points, I simply found all connected regions of <9. I say "simply" because I just threw things at fgl, but setting the graph up first took a bit of work. buildGr is fast but picky about the exact order things come in with.

  77. adventofcode

    My solutions to Advent of Code events. (by tadeuszwachowski)

    Python

  78. aoc

    Discontinued Advent of Code solutions (by sjmulder)

    - C -

  79. Advent-of-Code-2021

    Made it through all 25 days of Advent of Code for the second time! (by Leftfish)

    Figuring out that part 2 was essentially the 'find islands in a 2d matrix' problem was the easy thing. Remembering how to implement a DFS or BFS was another story. So I ended up implementing both for learning purposes (Python).

  80. aoc2021

    Advent of Code 2021 (by foolnotion)

    code on github

  81. aoc

    Haskell

  82. advent-of-code-kotlin

    Advent of code 2021 - Kotlin

    Kotlin solution, probably not the most efficient but does the job.

  83. AoC2021

  84. advent-of-code

    Solutions for Advent of Code 2017 in javascript (ES6) (by Akallabet)

    Solution in Javascript, messy part1, nice multi recursions for part 2

  85. AOC2021

    Discontinued My Haskell solutions for the 2021 edition of the Advent of Code (by MatthiasCoppens)

  86. AoC2021

    Advent of Code 2021 (by MagicHatJo)

    Python 3 solution (Github link) with only standard libraries. Runs both halves individually in 0.02s total.

  87. AdventOfCode2021

  88. advent-of-code-2021-rs

    Advent of Code 2021 solutions in Rust

    Rust: https://github.com/cadubentzen/advent-of-code-2021-rs/blob/master/src/bin/day09.rs

  89. adventofcode

    Advent of code solutions (by mathsaey)

  90. AdventOfCode

    My solutions to the Advent of Code puzzles. (by codevogel)

  91. aoc2021

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

    Elixir. Simple Union-Find via reducing maps to themselves.

  92. advent-of-code2021

  93. advent_of_code

    Advent of Code solutions (by domm)

  94. aoc2021

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

  95. AdventOfCode

    Advent of code daily challenge (by WilliamLP)

  96. adventofcode2021

    aoc 2021 (by acr13)

  97. advent-of-code-2021

    Solutions for the Advent of Code 2021 puzzles (by lucashmsilva)

  98. AoC2021

  99. aoc

    My solutions to adventofcode.com (by ciscou)

  100. advent-of-code-2021

    small coding exercises for christmas (by snhmibby)

    Full code here

  101. advent-of-code-2021

    My solutions to advent of code 2021 in deno/TS (by J-Swift)

  102. adventofcode2021

    Discontinued Advent Of Code 2021 Solutions (by agardes)

    Had a headache with part two, thinking that adjacent values had to be consecutive. It just needed to be less. Javascript solution

  103. AdventOfCode2021

  104. advent2021

    Advent of Code 2021 in Rust (by jeremylt)

  105. aoc

    Advent of Code (Each solution in different language) (by Pan-Maciek)

    Clojure/Racket

  106. aoc2021

  107. advent-of-code

    Watch me give up half way through >_> (by gabts)

  108. AdventOfCode2021

    This was one of those few times where I was pretty happy with what I wrote the first time through.

  109. AoC2021

    Advent of Code 2021 (by gereons)

  110. Advent-of-code-2021

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

  111. aoc-2021-in-kotlin

  112. aoc

    Advent of Code Solutions (by joeyemerson)

  113. advent-of-code-2021

    Python, using numpy for part 1 and scipy for part 2: https://github.com/harry-gibson/advent-of-code-2021/blob/main/day_09/day_09.py

  114. AdventOfCode2021

    Discontinued [GET https://api.github.com/repos/mohammedsouleymane/AdventOfCode2021: 404 - Not Found // See: https://docs.github.com/rest/repos/repos#get-a-repository] (by mohammedsouleymane)

    C#: https://github.com/mohammedsouleymane/AdventOfCode2021/blob/master/AdventOfCode2021/Day9.cs

  115. advent-of-code-2021

    A solution in Rust.

  116. aoc-2021

    Advent of Code 2021 with C#/LINQ (by jasonincanada)

    C# solution, simple flood-fill type algo. I found a use for C# 9.0's record types, explained in the blurb at the top of the file

  117. aoc2021

    Advent of Code 2021 (by xphade)

  118. aoc21

    Discontinued Advent of Code Solutions [Moved to: https://github.com/jakergrossman/aoc] (by jakergrossman)

    Solution for today in Common LISP.

  119. AdventOfCode-2021

    AdventOfCode (2021) Python, Scala, maybe Zig (by KevinDuringWork)

    Solution (ammonite) - Couldn't do this without recursion and an immutable map without blowing up the heap.

  120. advent-of-code-2021-rs

    Rust

  121. aoc2021

    Advent of Code 2021 (by jslepicka)

    You don’t necessarily need to use recursion (which I also suck at implementing). Here’s my iterative version: https://github.com/jslepicka/aoc2021/blob/master/9.py

  122. adventofcode

  123. advent-of-code-2021

    My solutions for the Advent of Code 2021 challenge. (by 7dunham22)

    For the full implementation, see my code here.

  124. aoc2021

    Advent of code 2021 in Kotlin! (by crnkofe)

  125. AdventOfCode_2021

  126. AdventOfCode2021

  127. aoc2021

    Rust implementation of aoc2021 problems (by devzero)

  128. advent-of-code

    My solutions for Advent of Code (by Apreche)

  129. advent-of-code-2021

    PHP solution, simple DFS for part 2 :

  130. advent_of_code

    My solutions to advent of code puzzles (by z3y50n)

    Day 9 using python

  131. AOC2021

  132. AdventOfCode2021

    adventofcode.com (by AG-Guardian)

  133. advent-of-code-21

  134. adventofcode

    scala efforts in the advent of code. (by dr-jerry)

    Full version here

  135. advent-of-code-jq

    Solving Advent of Code with jq

    # [JQ](https://github.com/odnoletkov/advent-of-code-jq) [ [inputs/"" | map(tonumber)] | . as $map | (range(length) | [.]) + (range(first | length) | [.]) | select( [ ., first += 1, first -= 1, last += 1, last -= 1 | select(all(. >= 0)) | $map[first][last] // empty ] | select(first == min and first != .[1]) ) | [ recurse( . as [$y, $x] | first += 1, first -= 1, last += 1, last -= 1 | select(all(. >= 0) and ($map[first][last] | . < 9 and . > $map[$y][$x])) ) ] | unique | length ] | sort[-3:] | .[0] * .[1] * .[2]

  136. adventofcode2021

    My solutions to the Advent of Code 2021 (by bmatcuk)

  137. adventofcode

    My collection of Advent of Code solutions in a slightly overkill project setup 🙃👻 (by marcelblijleven)

  138. aoc-typescript

  139. advent-of-code

    Cheating a bit, by using my existing AOC library for handling of 2D maps. Made the overall code fairly straightforward:

  140. AdventOfCode2021

    My Advent of Code solutions (by spencerwi)

    F#: https://github.com/spencerwi/AdventOfCode2021/blob/main/day9/Program.fs

  141. AdventOfCode2021

    🎄 Advent of Code 2021 https://adventofcode.com/2021/ (by vivianamarquez)

  142. aoc-event

    Discontinued Created with StackBlitz ⚡️

    My solutions in my git repository => Git And you can try it online at => Stackblitz

  143. advent-of-code

  144. Advent_of_Code_in_Pascal

    My solutions to the Advent of Code, in Free Pascal

    Pascal 2437/6187

  145. advent-of-code-2021

    Advent of code 22021 (by RansomTime)

  146. AdventOfCode2021

    AdventOfCode 2021 solutions (by Meldanor)

  147. AdventofCode2021

  148. advent_of_code_2021

    Advent of code 2021 puzzles (by mikefarquhar)

    GitHub link for code

  149. Aoc2021

    Advent of code 2021 solutions (by abaptist-ocient)

    Rust. I took a somewhat different approach to filling the basins. Each one is “named” and grows on each iteration through https://github.com/abaptist-ocient/Aoc2021/blob/main/src/bin/09.rs

  150. AdventOfCode2021

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

    https://github.com/willkill07/AdventOfCode2021/blob/main/days/Day09.hpp https://github.com/willkill07/AdventOfCode2021/blob/main/days/Day09.cpp

  151. AOC2021

    Advent of code solutions 2021 (by calebwilson706)

  152. AdventOfCode

  153. Advent-of-Code-2021

    JavaScript - Part 1 and Part 2, each with comments.

  154. aoc-2021

    My first solution had a brute-force search for minimum points, and a BFS to find the basins (https://github.com/brett-lempereur/aoc-2021/blob/main/day-9/solution.rkt).

  155. advent-code

    Advent of Code is an Advent calendar of small programming puzzles

    GitHub Solution

  156. AdventOfCode

    Fun one! Got it fairly compact in rust (part 1 & 2).

  157. aoc2021

  158. adventofcode2021

    Github

  159. advent-of-code-2021

    Advent of Code 2021 code challenge solutions. Kotlin this year! (by aormsby)

    Kotlin solution with some recursion on Part 2. Fast, but feels clunky to me. Like I could've slimmed it down. Open to suggestions. Nice problem overall, though! :)

  160. AdventOfCode

    Advent of Code Solutions (by auxym)

  161. advent

    Advent of code in Racket (by hencq)

  162. advent_of_code

    Solutions to programming puzzles on Advent of Code (by Praful)

    Part 2 (extract shown below) was a matter of starting with the low points found in part 1 then recursively looking around for relevant points. Full code on GitHub

  163. advent-of-code

    Advent of code solutions (by tallbikeguy)

  164. AdventOfCode2021

  165. adventofcode2021

    Lua https://github.com/mrbuds/adventofcode2021/blob/main/9-2.lua

  166. adventofcode

  167. AdventofCode

  168. AdventOfCode

    Python

  169. AdventOfCode

  170. advent-of-code

    Collection of JS solutions for puzzles from adventofcode.com 🎁🎄 (by romellem)

    Code can be found in this repo.

  171. advent-of-code

    Advent of Code puzzles (by KT421)

  172. aoc2021

    I will be trying the this years Advent of Code. I am unsure of what language I will be using. Let's see how this goes. (by jtagrgh)

    Pt 1: https://github.com/jtagrgh/aoc2021/blob/main/day9-smoke-basin/pt1.c

  173. AdventOfCode2021FSharp

    Solutions for Advent of Code 2021 in F#

    F# with Jupyter Notebook. I had a hard time wrapping my head around the recursion on this one for Part 2. Got some helpful tips on the sub-reddit!

  174. aoc-2021-clj

    Clojure, source and tests. Part 1 was simple but I couldn't get anything going for part 2 after a couple of hours. I initially tried a naive DFS approach (which I know essentially nothing about) but wasn't successful in constructing a tree from a low point.

  175. AdventOfCode2021.jl

    Advent of Code 2021 in Julia

  176. adventofcode_2021

    My solutions for AoC21 in R and Julia

    After some serious de-spaghettification: R / Rstats

  177. aoc

    Advent of Code (by c-kk)

  178. Advent_of_Code_2021

    My solutions to Advent of Code 2021 (by neelakantankk)

    Finally managed to solve Part 02 in Python. I was stuck because I could not figure out a way to go through all the points around a low point till I got to a 9. Then yesterday I say u/skarlso's post about Red Blob games and the various pathing algorithms, and the breadth-first-search example just unblocked the whole solution for me. :)

  179. AdventOfCode

    9December (by FvDam)

    github

  180. advent-of-code-2021

    Discontinued My solutions to https://adventofcode.com/2021 (by plan-x64)

  181. AdventOfCode

    C# solutions for Advent of Code (by Rekkonnect)

  182. AoC2021_0

    Advent of Code 2021

    part 1 part 2

  183. adventofcode21

    Advent of Code 2021 (by Overij)

    PHP

  184. AdventOfCode2021

    Advent of Code 2021 challenge: 13 different languages, one chosen at random every day! (by Qualia91)

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

    CodeRabbit logo
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

  • -🎄- 2021 Day 19 Solutions -🎄-

    94 projects | /r/adventofcode | 18 Dec 2021
  • Real time in no time

    1 project | dev.to | 9 Dec 2024
  • Advent of Docker: Day 0

    1 project | dev.to | 2 Dec 2024
  • My December Adventure (of code)

    1 project | dev.to | 1 Dec 2024
  • 2024 Developer Advent Calendars

    1 project | dev.to | 30 Nov 2024