Our great sponsors
-
-
I also did it with numpy. https://github.com/moink/advent2022/blob/master/day8/day8.py
-
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.
-
Here is my oneline solution in JS (Node) for Day 8 part 2 :) Part 1 and other days here : https://github.com/LoicTouzard/AdventOfCode/blob/main/2022/day8/
-
-
Java: Code
-
Code is here
-
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.
-
AdventOfCode
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA
Python3, 353/412. Video on its way; I had some recording issues today. Code.
-
Python 120/64 GitHub
-
My Ruby version
-
-
Code
-
Python (2301/3184)
-
Python code
-
code
-
-
Surprised to see im top 10k today despite taking an hour and 20 https://github.com/Lukeisun/AdventOfCode2022/blob/master/Day8/main.go
-
Part1: https://github.com/sdatko/advent-of-code/blob/master/year-2022/day-08/part-1.py Part2: https://github.com/sdatko/advent-of-code/blob/master/year-2022/day-08/part-2.py
-
Code
-
Part 1 had a massive delay since i found a parser bug, but otherwise this was smooth sailing. Lots of off by ones, and luckily the example output was very helpful with that.
-
C# Solution 29/334
-
Link to repo: https://github.com/udoprog/aoc2022/blob/main/years/2022/src/bin/d08.rs
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
My Scala solution.
-
-
-
In part 1, I parsed the input, first getting the size of the input (bear in mind I'm challenging myself to assume nothing about the size of the input), then reading it in. I could probably have used loop, lodsb, and stosb to write more concise parsing code. Then, for each cardinal direction, I marked the trees that were visible from that direction, and finally counted the trees that were not visible from any cardinal direction.
-
code
-
JavaScript, NodeJS https://github.com/raptox/advent-of-code/blob/main/day8.js
-
-
Kotlin Day 08 Generic brute force search in each direction from each inner tree until we hit the edge, or found a tree that blocks our view.
-
Python3, complex numbers for coordinates, using inf to represent out of bounds.
-
-
Day 8 Solution
-
-
AdventOfCode
Hacky solutions for [Advent of Code](https://adventofcode.com), working on past problems (by AllanTaylor314)
Python (after a couple of false starts where I counted the same tree from several directions) and then one of the most convoluted Google Sheets formulae that I have ever made (See tabs 8.1 and 8.2)
-
Took ages, but after some restructuring it's quite ok. [Github Link]
-
-
Interesting, very different to my F# solution
-
I try to have the code as clean, commented and well formatted as my sanity allows My solution
-
-
C++
-
-
Python(GitHub)
-
I finished refactoring my code (https://github.com/martenhernebring/aoc2022/tree/solution) and found a way to traverse four directions:
-
Python, looking in all directions, and finding a good use case for the `for..else` construct
-
Github
-
-
-
GitHub
-
-
advent-of-code-2022
My solutions to the 2022 Advent of Code as shiny Jupyter notebooks. You can run and interact with the code and the solutions directly from your browser via Binder. (by markusschanta)
Repo with all solutions as Jupyter notebooks
-
Rust
-
Part 1 - used all() for checking.
-
C#
-
GitHub
-
Aimed for self-explanatory code after making buzz yesterday
-
-
-
Rust with runtime ~450µs
-
aoc2022
Trying to solve Advent of Code 2022 in 25 different languages (1 day = 1 language) (by GoldsteinE)
-
-
C, it's not often that you get to use monotonic stacks, but they're pretty awesome. I think I could clean this up further into a single generic handler and two functions that do the lifting, but I'm not sure that it would be any cleaner or easier to read. [Github]
-
Scala
-
C#
-
-
My solution in Python for both parts (I used Numpy):
-
Python without numpy: https://github.com/danielsamuels/advent-of-code/blob/master/year_2022/day_8.py
-
Well, it took me a while to realise that in part 1 you always have to check the whole row or column because a higher tree can come at any point ... And except for skipping the borders, I couldn't come up with any sort of clever optimisation that would help reduce the O(N^2) complexity. It still runs in under 1 ms on a Mac Mini M1 according to hyperfine. Full code 52 lines without space/comments: https://github.com/ednl/aoc2022/blob/main/08.c
-
-
V1 - (Single dimensional Vector) https://github.com/anatomic/advent-of-code/blob/main/src/main/scala/year2022/Day08.scala
-
-
Haskell. Pretty straightforward to do in point-free haskell, as you can get all the orientations of the grid by applying some list transformations, and after that its some mapped-scan/folding to reduce back to one dimension.
-
C#
-
-
-
-
python solution
-
advent-of-code-2022
Python solutions for Advent of Code 2022's problems. This is done to train with coding problems and learn Python language (by iLukez)
Python. I'm a newbie to Advent of Code and I'm using it to learn Python. It isn't the more readable solution as I could've used numpy and rotate the list instead of checking Top, Right, Bottom and Left. Also, since I'm new to Python, i'm sure this solution could've been implemented in much more readable ways. Any suggestion is welcome
-
RustLangFun
My wack at the language voted StackOverFlow's"most loved programming language for five years running"
Part 1 and 2- Github
-
Here's my contribution for today, perhaps a bit shorter than most solutions not focusing on providing one-liners but I tried to avoid repeating loops. My approach of phase 2 might be of interest for you guys.
-
-
-
-
Scala. It's ugly, but it works ¯\_(ツ)_/¯
-
-
Python, maybe not the best solution, but this challenge really threw me for some reason https://github.com/PetchyAL/AoC2022/blob/main/solutions/day8/day8.py
-
Python solution tried to think of a clever way to do part 2 but it was taking too long. Ended up just searching each direction then finding the first time a tree was >= size.
-
Code
-
Current solution uses one Vec (for the lines), which does perform slightly better than if I would use only the original bytes of the input (&[u8]); added a branch with that bytes version if you care to check. Not sure if it's about some cache line friendliness or the mess of iterators.
-
anyway here is my github repo my solutions for all previous days are there too
-
-
I'm using this template. If you are familiar with Rust you could try running my code in this template to see what speeds you get. This is with the --release flag.
-
Java solution with recursion
-
-
-
Part 1
-
Part 1
-
Day08
-
-
-
Today's code
-
Rust is fast. I'm down at 80 µs for both parts! Repo
-
advent-of-code-2022
🎄 My Advent of Code solutions in Rust. http://adventofcode.com/2022 (by timvisee)
I'm using the guy who does "the entire AoC in less than a sceond"'s timing code, so I assume it's kosher
-
Code for part 1 and part 2; Videos for part 1 and part 2 solving the example 5x5 forest, because no one wants to watch the solving of the 100x100 forest!
-
Part 1
-
Part 1
-
I'm new on Reddit, so I'm not sure what do you mean by old Reddit. Anyways, thank very much for pointing it out. On the other hand, I just updated the comment with a link with the solution. Also, there is other link to the github repo with my solutions.
-
rust (link) treated the string as a flattened array and just jumped around using its shape.
-
58 LOC including constexpr tests. Github
-
Rust
-
AdventOfCode2022
This is my attempt to solve AdventOfCode2022 (https://adventofcode.com/2022/) and learn some Rust (by samoylenkodmitry)
Rust, first attempt was to use collections-flow syntax, but simple loops were much easier to use https://github.com/samoylenkodmitry/AdventOfCode2022/blob/master/src/day8.rs (also GitHub copilot is good at predicting next part of iterations)
-
part 1 part 2
-
-
part1
-
Elixir
-
Rust: https://github.com/ropewalker/advent_of_code_2022/blob/master/src/day08.rs — there are two solutions for part 2, and one of them should be algorithmically better, has fewer iterations, but still runs longer than the naïve solution. And at this point, I am too tired to figure out why this happens.
-
Solution: https://github.com/dwhinham/aoc/blob/main/src/day8.c
-
-
advent-of-code-2022
Joel Eisner's completed TypeScript code challenges for "Advent of Code" 2022 (by joeleisner)
-
Github
-
I made the change. Previous version is here for reference :).
-
Groovy
-
[Part 1 paste](https://topaz.github.io/paste/#XQAAAQCfBAAAAAAAAAA7mkrvHeIvDZUizuO2LI0KXEPUFLLgeIPRqbv/0boLpBFLWFSVzSOsosoTTCOPvdaoIyVLtar8lYfcl5NX2uQX0BYmomf6kLl9tJtK9gBU9EHZRc5mZjTyQno2McbXnob9u60RUCnJTcHaaoM9WBk71acPHN4ut5TLEy2bA8mqvb/UbaB5xBuEr6M3/ziyMaV/RlJiV9rXHnhdZNEtKImWv6LLZ9/NCGNT/Sz09kUsmxnB645uZiumLTkIEzO4/0sfgPtLie5kZdFkTdXSEI4X1txM5btjZFWZfUAo2SyM1Nqfis3MHtBumskEknnyZWxAiFxwfZO2Qbm8oOpJYRucXKwEnYlUJQE54rcfMUo9Lq5PqlGKV510shoSsH2WVWmWy9I84dQv0vuoYGXmlgWvYfsM7HEQShVXi2Sku7hY/F4WB1XP9Isn+3RVJaYjVVr1b4H7tFhaeFXrPPOdhG3bDVBB4Q2rjRxlyl6MWOUmWNPqjUo/9No5OWDH1ZA+rlfowhB/4FXvzmtaBZeIYiDsnZwgCMjCsl8C9SJot0drI0MZU4SXZigZvTeQ9yaExkgEAzCi2A48X752knqRQ1FJdcj8x07IlEvhzOkBHSvfX0uyoaQ3fN5HoQJ1rd2z5CX/+OzybQ==)
-
Lots of list folding and general munging. Full writeup on my blog and code on Gitlab.
-
How I learned to love brute force
-
C# on .NET 6.0: Part 1 Part 2
-
PHP - https://github.com/onei2l/adventofcode_php/blob/master/2022/08/index.php (only functions for, count, mb_str_split)
-
-
code
-
Kotlin: https://github.com/rasmusfaber/adventofcode/blob/master/src/main/kotlin/xyz/faber/adventofcode/year2022/day8/day8.kt
-
Kotlin, compact solution in 14 lines of code, no cheating (Kotlin standard formatting). https://github.com/MikeEnRegalia/advent-of-code/blob/master/src/main/kotlin/aoc2022/day08.kt
-
-
I've also used matrix transponisation in elixir for this day https://github.com/SuddenGunter/adventofcode/tree/main/2022/day8/lib
-
code on github
-
C solution
-
Part 1 - Phippre
-
Go/Golang
-
somewhat compact python solution: https://github.com/ndepaola/advent-of-code/blob/main/years/2022/8/2022_day_8.py i tried to minimise reading lists into memory and unnecessary iterations
-
Here's my Rust solution.
-
-
code on Github
-
Swift
-
Swift. We don't have good types for this. 🤮
-
Dlang bruteforce solution
-
AdventOfCode-rust
Repo for solutions to advent of code in rust. The purpose is for me to learn the rust language (by TheAce4K)
Here is my solution if you want to take a look: Solution
-
F# - Under 60 lines, readable code, higher order function and composition makes it easy to write complex code
-
Relied on numpy in my Python solution for element-wise array operations.
-
Solution in Scala
-
Pretty fast but not short! :) Source code here https://github.com/dionysus-oss/advent-of-code-2022/tree/main/day-8 and a video of me working through the problem https://youtu.be/ImNKpKKWuWo
-
Part1: yes, part2: no. https://github.com/nhofsted/adventofcode2022/blob/main/src/day8.ts
-
C# with a bunch of LINQ: GitHub
-
Here's my code btw, it's pretty lengthy but I believe it does the minimum amount of operations required, someone correct me if I'm wrong. https://github.com/toni-neurosc/AdventOfCode/blob/main/2022/d8/d8.cpp
-
Java (198 / 869)
-
Annotated code and Visualization
-
Github
-
The dynamic programming solution was about twice as slow on part 2, and perhaps 50% slower on part 1 (where the initial solution didn't stop when it hit an obstacle).
-
Python, which is not my native tongue. Tried to avoid repeating myself but feels like I came up short due to there being 4 different functions that iterate over the forest. Oh well.
-
https://github.com/LinAGKar/advent-of-code-2022-rust/blob/main/day8a/src/main.rs https://github.com/LinAGKar/advent-of-code-2022-rust/blob/main/day8b/src/main.rs
-
Python
-
Github
-
-
Part 1 - took me most of the day to solve 😢
-
Code | Blog Walkthrough
-
Here's Day 8 part 1 & Day 8 part 2 as written in awk.
-
Code
-
-
Advent-of-Code
Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like (by SvetlanaM)
My solution in Python = https://github.com/SvetlanaM/Advent-of-Code/blob/master/2022/day08/day08.py
-
Python 3 solution using numpy. I got held up because I assume (but know better) that numpy arrays are [x,y] instead of [row, col], which is [y,x].
-
Here's the solution repo and also fruity.
-
Here's the solution repo and also fruity.
-
-
Julia. Made a lot of silly mistakes - misread problem, off-by-ones, plus some bad indexing and data structures in Julia. All good lessons!
-
-
Python
-
Python 3: GitHub. Parts 1 & 2. 522 characters including file name, 18 lines, no imports.
-
-
Code 8a Code 8b
-
Python 3.11 Recursive functions with backtracking: full implementation here
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives