-🎄- 2021 Day 9 Solutions -🎄-

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

Our great sponsors
  • SonarQube - Static code analysis for 29 languages.
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
  • 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

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

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

  • adventofcode

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

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

  • advent-of-code-2021

    AOC in go (by alextanhongpin)

  • adventofcode

    Answers to Advent of Code (by viceroypenguin)

  • AdventOfCode

    python 1016/334

  • aoc

    My Advent of Code solutions (by vypxl)

    Python 3 668 / 616

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

  • deno_aoc

    🎄 Advent of code solutions written in TypeScript for Deno.

  • advent-of-code-2021

  • adventofcode

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

    My Scala solution.

  • advent-of-code-go

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

  • AdventOfCode2021

  • advent-of-code-wim

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

    Python

  • advent

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

  • AdventOfCode

  • Advent-of-Code

    My solutions or attempts at solutions to the Advent of Code event.

    Python Using image libraries to not do any real work!

  • aoc2021

    Advent of Code 2021 Solutions (by nlowe)

    Go, 1730/3574

  • 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

  • AdventOfCode2021

  • Advent-of-Code

    Advent of Code (by michaeljgallagher)

    Another fun one today!

  • aoc2021

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

  • aoc2021

    Advent of code 2021 in JS (by TheAngularGuy)

  • advent-of-code-2021

    Advent of Code 2021 Submissions (by mariotacke)

  • aoc2021

    Advent of Code 2021 (by Emerald-Element)

    Part 1 solutionPart 2 solution

  • Advent-of-Code-2021

    Part 1

  • adventofcode

    Advent of Code solutions (by jjclark1982)

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

  • adventofcode-2021

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

    That said, Day 9 in Go.

  • Advent-of-Code-2021

    Advent of Code Solutions 2021 in Python (by DenverCoder1)

  • advent-of-code

    Common Lisp. Nothing special, just a BFS.

  • advent-of-code

    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!

  • aoc2021

    Advent of Code (2021 edition) (by Samplasion)

    TypeScript

  • AdventOfCode

  • advent-of-code-solutions

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

  • aoc2021

    solutions for advent of code 2021 (by tumdum)

    my rust day9:

  • AlgorithmProblems

    Solutions to Algorithm Problems :chart_with_upwards_trend: :neckbeard:

    Did a recursive DFS to solve part 2. github code

  • aoc

    rust solution part 2 bfs

  • advent-of-code-2021

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

  • aoc2021

    Advent of Code 2021 (by sotolf2)

  • adventofcode

    My AdventOfCode implementations (by nielsutrecht)

    Day9

  • aoc2021

    Advent of Code - 2021 (by en0)

    Part1

  • 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

  • AdventOfCode-2021

    My solution to AdventOfCode 2021 problems. (by MubeenKodvavi)

    Part1 Part2

  • aoc2021

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

  • advent_of_code

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

    Solved part2 using bfs: y2021/day_09.ex

  • adventofcode

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

  • 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';

  • advent-of-code-2021

  • AoC2021

    Advent of Code 2021 in F# (by kimvais)

    So much more elegant than my solution

  • advent-of-code-2021

    In Common Lisp (by brunal)

  • AdventOfCode2021

    Advent of code 2021 (by marcodelmastro)

  • advent-of-code

    My solutions to advent of code problems (by jtrinklein)

  • aoc2021

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

    Python source

  • advent-of-code-2021

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

  • AoC

  • advent-of-code

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

  • adventofcode2021

    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

  • AdventOfCode

    Advent of Code Solutions over the years (by dmiller2606)

    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

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

  • Solution in Python

  • adventofcode21

    2021 advent of code solutions

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

  • advent-of-code-kotlin-2021

    My solution attempts to Advent of Code 2021

  • advent-of-code-2021

  • AoC

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

    python solutiuon

  • advent-of-code-koto-2021

    Solving Advent of Code 2021 with Koto

    Solution

  • advent-of-code

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

  • advent-of-code

    Advent Of Code Solutions (by sreedevk)

  • aoc21

    Github

  • adventofcode2021

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

  • Advent-Of-Code

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

  • aoc2021

    Advent of Code 2021 - my answers

    Haskell 1848/1580

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

  • adventofcode

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

    Python

  • aoc

    Advent of Code solutions (by sjmulder)

    - C -

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

  • aoc2021

    Advent of Code 2021 (by foolnotion)

    code on github

  • aoc

    Haskell

  • advent-of-code-kotlin

    Advent of code 2021 - Kotlin

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

  • AoC2021

  • 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

  • AOC2021

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

  • AoC2021

    Advent of Code 2021 (by MagicHatJo)

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

  • AdventOfCode2021

  • 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

  • adventofcode

    Advent of code solutions (by mathsaey)

  • AdventOfCode2021

    My solutions to the Advent of Code 2021 puzzles. (by kemmel-dev)

  • aoc2021

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

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

  • advent-of-code2021

  • advent_of_code

    Advent of Code solutions (by domm)

  • aoc2021

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

  • AdventOfCode

    Advent of code daily challenge (by WilliamLP)

  • adventofcode2021

    aoc 2021 (by acr13)

  • advent-of-code-2021

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

  • AoC2021

  • aoc

    My solutions to adventofcode.com (by ciscou)

  • advent-of-code-2021

    small coding exercises for christmas (by snhmibby)

    Full code here

  • advent-of-code-2021

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

  • adventofcode2021

    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

  • AdventOfCode2021

  • advent2021

    Advent of Code 2021 in Rust (by jeremylt)

  • aoc

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

    Clojure/Racket

  • aoc2021

  • advent-of-code

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

  • AdventOfCode2021

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

  • AoC2021

    Advent of Code 2021 (by gereons)

  • aoc-2021-in-kotlin

  • aoc

    Advent of Code Solutions (by joeyemerson)

  • 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

  • AdventOfCode2021

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

  • advent-of-code-2021

    A solution in Rust.

  • 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

  • aoc2021

    Advent of Code 2021 (by xphade)

  • aoc21

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

    Solution for today in Common LISP.

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

  • Rust

  • 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

  • adventofcode

  • advent-of-code-2021

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

    For the full implementation, see my code here.

  • aoc2021

    Advent of code 2021 in Kotlin! (by crnkofe)

  • AdventOfCode_2021

  • AdventOfCode2021

  • aoc2021

    Rust implementation of aoc2021 problems (by devzero)

  • advent-of-code

    My solutions for Advent of Code (by Apreche)

  • PHP solution, simple DFS for part 2 :

  • advent_of_code

    My solutions to advent of code puzzles (by z3y50n)

    Day 9 using python

  • AOC2021

  • AdventOfCode2021

    adventofcode.com (by AG-Guardian)

  • advent-of-code-21

  • adventofcode

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

    Full version here

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

  • adventofcode2021

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

  • adventofcode

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

  • aoc-typescript

  • advent-of-code

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

  • AdventOfCode2021

    My Advent of Code solutions (by spencerwi)

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

  • AdventOfCode2021

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

  • aoc-event

    Created with StackBlitz ⚡️

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

  • advent-of-code

  • Advent_of_Code_in_Pascal

    My solutions to the Advent of Code, in Free Pascal

    Pascal 2437/6187

  • advent-of-code-2021

    Advent of code 22021 (by RansomTime)

  • AdventOfCode2021

    AdventOfCode 2021 solutions (by Meldanor)

  • AdventofCode

  • advent_of_code_2021

    Advent of code 2021 puzzles (by mikefarquhar)

    GitHub link for code

  • 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

  • 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

  • AOC2021

    Advent of code solutions 2021 (by calebwilson706)

  • AdventOfCode

  • Advent-of-Code-2021

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

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

  • advent-code

    Advent of Code is an Advent calendar of small programming puzzles

    GitHub Solution

  • AdventOfCode

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

  • aoc2021

  • adventofcode2021

    Github

  • 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! :)

  • AdventOfCode

    Advent of Code Solutions (by auxym)

  • advent

    Advent of code in Racket (by hencq)

  • 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

  • advent-of-code

    Advent of code solutions (by tallbikeguy)

  • AdventOfCode2021

  • adventofcode2021

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

  • adventofcode

  • AdventofCode

  • AdventOfCode

    Python

  • AdventOfCode

  • advent-of-code

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

    Code can be found in this repo.

  • 2021-advent-of-code

    Advent of Code 2021 puzzles

  • 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

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

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

  • AdventOfCode2021.jl

    Advent of Code 2021 in Julia

  • adventofcode_2021

    My solutions for AoC21 in R and Julia

    After some serious de-spaghettification: R / Rstats

  • aoc

    Advent of Code (by c-kk)

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

  • AdventOfCode

    9December (by FvDam)

    github

  • advent-of-code-2021

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

  • AdventOfCode

    C# solutions for Advent of Code (by AlFasGD)

  • AoC2021

    Advent of Code 2021 (by travis-miller)

    part 1 part 2

  • adventofcode21

    Advent of Code 2021 (by Overij)

    PHP

  • AdventOfCode2021

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

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