-
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
Mine is similar but I keep a stack of abspaths (q07.py). I don't quite understand how you are able to get away without doing that in the accumulate - are you implicitly assuming subdirectory basenames are unique?
-
Here's my version in PHP. I used a Tree representation for building the filesystem structure.
-
-
F# - Was able to get the answer by only parsing 'cd' and 'file' lines. A single fold and then sum/min from aggregated data.
-
First (slower) version using zippers. I absolutely had to use them because I just learned about clojure.zip recently and this puzzle seemed to be a perfect victim for me having fun creating a huge tree structure.
-
Here it is if you'd like to see: https://github.com/hugseverycat/aoc2022/blob/main/day7attempt2.py
-
Yeah, I spend a lifetime (I'm tired sorry) wrestling with the borrow checker until I stumbled upon Rc and RefCell, I'm new so I did not know about it, and after a few rewriting I finally managed to get a real tree with ref inside. I probably would have finished 3 hours sooner if I tried the Hashmap approach, but I wanted that damn tree (code)
-
-
AdventOfCode
My Advent of Code solutions. I also upload videos of my solves: https://www.youtube.com/channel/UCuWLIm0l4sDpEe28t41WITA
Python3, 9/4! Video. Code. I'm happy to make the top 10!
-
QDirStat
QDirStat - Qt-based directory statistics (KDirStat without any KDE - from the original KDirStat author)
It's used by several disk usage utilities like https://github.com/shundhammer/qdirstat
-
-
-
Go/Golang | 1417/2403
-
-
advent-of-code
My Advent of Code submissions. For 2021 and before, these are the original code I used, without any modifications after-the-fact. As such, they are probably not as efficient or short as they should be, because I want a working solution faster, not a better solution. For 2022 and after, these are the solutions uploaded to my YouTube channel.
Part 1
-
-
Code
-
Code
-
C# .NET GitHub
-
Code
-
Here is the GitHub page if you wanna look closer. Definitely open to improvements.
-
My solution in Scala
-
-
-
Kotlin Day 06 I went the tree route, and build up a directory structure as I went along
-
object oriented crystal: https://github.com/robacarp/advent_of_code/blob/master/2022/7/solution.cr
-
Code Here
-
-
Ruby 4028/3734
-
python 3.11
-
advent-of-code-scala
Complete 2022 to 2015 entries for the annual Advent of Code challenge, written in concise idiomatic functional Scala.
Scala (2973 / 2888)
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 and 2024 in Scala (by sim642)
My Scala solution.
-
PowerShell 7
-
Python [1810/1396] (with and without recursive structures), then Google Sheets. The flat data structure was useful for working with the sheet (I don't think spreadsheets are designed for recursion)
-
-
[Rust](https://github.com/iDoEverything/adventofcode22)
-
-
My Haskell solution https://github.com/clatisus/advent-of-code-y2022/blob/master/src/Day7.hs
-
Clojure - Code
-
-
I remember the first time I needed to close(cmd) too - I was so frustrated until I worked it out (much longer than 40 mins!). Here's my solutions: 1 and 2. The gotcha for me today was that I had been using the name of the directories as array indices, without checking to see if the directory names were reused... which they were.
-
My solutions in python and rust. The python version is my original and the rust version is after checking what some other people were doing. For some ungodly reason rust-analyzer thinks the scan_fmt! macro is invalid because I'm asking it for a String, but the rust compiler compiles it without issue. If anyone has a clue what's going on here I'd love to know.
-
-
-
Elixir — code, reflections
-
-
AOC
Solutions for Advent of Code, written in multiple languages, 2015/2020 done in C++, 2021 done in Rust (by Blakeinstein)
-
My dart solution is here: https://github.com/definev/AOC/blob/main/dart/day07.dart
-
-
GitHub
-
Finally got around to doing it in a language I've never used before for the day. Today's language of choice is Jakt, solution here.
-
rust, not good
-
Typescript
-
-
-
-
Python https://github.com/Pokemaster69/AOC2022/blob/main/day7.py
-
part 1 & part 2
-
Here is my python solution: https://github.com/VictorOnink/Advent-of-Code-2022/blob/master/Day_7_No_Space_Left_On_Device/day_7_file.py
-
Day 7
-
Rust (repo). Nice to brush up on tree structures again. No idea if it was the fastest method but the code is easy to follow at least.
-
Part 1 took a significant amount of time, since I had to develop the input parser; I assumed that the input was a pre-order traversal through the filesystem. I defined a struct to represent a tree node, and wrote the constructor for both struct variants. My parser looked at the input stream, and expected to see $ ls (as an internal correctness check). After it saw that, it looked ahead and counted the number of entries in this directory (.countEntryLoop). I then allocated space to hold those entries. Next, I parsed each entry (.parseEntryLoop). Finally, for each directory I saw, I skipped the cd to that directory and then recursed. Finally, I calculated the size of this directory as the sum of the sizes of its entries. I then skipped the cd .. at the end of the current directory entry (if there was any; I would have skipped past the end of the file for /, but I don't look after that anyways). Then, I had to do a standard structurally recursive traversal through the tree, summing those directory nodes whose size was more than 10,000. It's more difficult to write recursive functions in assembly, since you've got to be very careful to set up your arguments and prevent clobbering of registers you currently have in use.
-
-
Julia. Finally too many new things to learn at once in Julia to avoid getting ugly.
-
no_std Rust targetting 8-bit MOS6502: https://github.com/mrk-its/aoc2022/blob/main/day07/src/main.rs Computed in 11275620 cpu cycles
-
aoc2022
Trying to solve Advent of Code 2022 in 25 different languages (1 day = 1 language) (by GoldsteinE)
-
-
-
advent-of-code-2022
The solutions that I came up with for the Advent of Code 2022 in Ruby (by coding-red-panda)
solution (GitHub): https://github.com/coding-bunny/advent-of-code-2022/blob/main/day_7.rb
-
Julia (GitHub)
-
First attempt
-
C, some annoying input parsing and then very straightforward tree walking. Was expecting something a lot harder in part 2, so originally over-engineered, and ended up ripping a bunch of stuff out when part 2 was just another walk of directory sizes. ¯_(ツ)_/¯ [Github]
-
Github
-
Github
-
Ugly as hell but ended up working. Will improve later on. Javascript solution
-
Here's my PHP solution : https://github.com/mariush-github/adventofcode2022/blob/main/07.php
-
-
-
-
-
-
C preprocessor: https://github.com/camel-cdr/boline/blob/main/aoc22/aoc7.c
-
I would need some help, since no matter what I do, it seems like i get wrong anwser? Is there some "joke" or trick that I should account for, that the example doesn't contain? github
-
adventofcode
This repo contains (almost) all of my solutions for adventofcode problems. (by kiriDevs)
-
Python 3.8 solution
-
Calculate part 1 in one pass and do a second only over the sizes for part 2 (because we know the size of / only at the very end). Hot runs take ~13 µs on a Core i9-12900K, including I/O. Code is here.
-
Python @ github
-
Rust
-
Solution
-
-
Here's is a GitHub link to my solution for today challenge.
-
Solution
-
TypeScript, this one was pretty fun
-
you can find whole code here, I will show you the most interesting bit with traversing the instruction list with current path stored in pth column. parsed as ( select 'root' as t, '/' as nm, null as bytes, json_array('/') as pth, 1 as step union all select preparsed.t, case when preparsed.t = 'dir' or preparsed.t = 'file' then json_insert(pth, '$[#]', preparsed.nm) else preparsed.nm end as nm, preparsed.bytes, case when preparsed.t = 'cd' then json_insert(pth, '$[#]', preparsed.nm) when preparsed.t = 'dc' then json_remove(pth, '$[#-1]') else pth end as pth, step + 1 as step from parsed inner join preparsed on n = step ), only_dirs as ( select json_remove(nm, '$[#-1]') as nm, sum(bytes) as bytes from parsed where t = 'file' group by json_remove(nm, '$[#-1]') ), all_dirs_counted as ( select json_each.value as dirnm, sum(bytes) as bytes from only_dirs, json_each(only_dirs.nm) group by json_extract(nm, printf('$[%s]', iif(json_each.key > 0,json_each.key - 1, 0))) || json_each.value order by nm )
-
Python 3.11
-
Javascript
-
Also had to copy the maths for part 2 off someone as my brain melted before I could finish. Here's the whole thing so far and I did in JavaScript..
-
advent-of-code-2022
My solutions for the Advent of Code for 2022. https://adventofcode.com (by tanuki-billie)
-
-
my solution for day7 in rust https://github.com/Sreyas-Sreelal/aoc-2022/blob/master/day7/src/main.rs I think I can write a better solution
-
Typescript: github
-
I went with a tree and recursive function, and no assumptions about the maximum number of dirs/files/levels. So that took me a while, haha. Runs in 1.5 ms on a Raspberry Pi 4. https://github.com/ednl/aoc2022/blob/main/07.c Possible further optimisation: store dir sizes in the struct for re-use in part 2. But meh, I spent enough time!
-
-
Python - Day 7
-
Day 7, Part 1
-
Java 8 Solution
-
I haven't yet seen a tree parser that uses a recursive parser instead of a parent pointer, so I thought I'd throw my solution into the mix: Scala
-
github link
-
I'm building a tree structure of custom [file](https://github.com/micod-liron/advent-of-code/blob/main/AdventOfCode2022/AOCFile.class.st) and [directory](https://github.com/micod-liron/advent-of-code/blob/main/AdventOfCode2022/AOCDir.class.st) types and then folding over it. Smalltalk's dynamic nature and duck typing were really handy.
-
C++ Implementation (written by a Python guy): https://github.com/Mereep/advent_of_code_2022_cpp
-
Full code: https://github.com/afcasco/AdventOfCode/tree/main/src/main/java/com/adventofcode/y2022/day07
-
-
-
I solved it with just a stack and a list and no recursion in ~80 lines: https://github.com/lhecker/adventofcode_2022/blob/master/src/day07/main.rs
-
Solution for both parts in Rust:
-
-
Solved in some 50 lines of Rust, using just a flat HashMap to represent the file system: https://github.com/frjonsen/aoc2022/blob/master/day7/part2/src/main.rs
-
Probably too long to post, GitHub
-
Rust: https://github.com/ChiefMilesEdgeworth/advent-of-code-2022/blob/main/src/bin/07.rs
-
[Rust my repo]
-
Java GitHub
-
c++ repo
-
Not pretty, but I believe efficient enough. Uses a few Strings and a HashMap, but does avoid recursion. Interestingly enough latest version with some heap allocations is still better than a few of my attempts to use only the stack (with things like arrays, tinyvec). Performance is okay on my machine, but it's the slowest day so far [ref].
-
Python: GitHub
-
C# solution
-
My Python answer on Github
-
Golf in Ruby (207 Bytes) (GitHub)
-
Go
-
My Rust solution with tuple pattern matching. Tried to write it as idiomatic as I could, any advice?
-
github link
-
This one hurt, oof. Source here
-
[Source](https://github.com/Timmoth/AdventOfCode2022/blob/main/Solutions/Day7.cs)
-
AdventOfCode2022
This is my attempt to solve AdventOfCode2022 (https://adventofcode.com/2022/) and learn some Rust (by samoylenkodmitry)
Rust https://github.com/samoylenkodmitry/AdventOfCode2022/blob/master/src/day7.rs I am new to Rust, I am pretty proficient in java and kotlin, but how you can effectively implement graph-like structures in Rust? That didn't work for me ;(
-
My Python solutions involving Graphs part_1 part_2
-
No recursion, no maps, just a pair of vectors. Complete with compile-time tests. Github.
-
https://github.com/philipwhiuk/advent-of-code/tree/master/src/main/java/org/whiuk/philip/adventOfCode/twentytwentytwo/Seven.java I assumed it would matter at some point.
-
-
Github
-
This Lua code is run by loading the solver as a plugin, and then open the input file in neovim and run :AoC 2022 07 1. Haven't really befriended Lua yet though https://github.com/EmilOhlsson/advent-of-code/blob/main/lua/advent-of-code/2022/07.lua
-
Using strings, not a very elegant but it works Ruby
-
-
Advent-of-Code-2021
Made it through all 25 days of Advent of Code for the second time! (by Leftfish)
I totally recommend trying - it's going to be a lot of fun and you'll understand the structure better. I'm not a pro and I never studied CS - that's just my experience from last year (day 18).
-
I have actually made two versions of solution for D7. First, initial, which is more verbose and second in which, I've tried to compress my ideas but without losing too much of clarity.
-
Rust: https://github.com/dehan-jl/adventofcode-2022/blob/main/day7-alternate/src/main.rs
-
AdventOfCode2022
Solutions to all 25 Advent of Code 2022 in Rust 🦀 Less than 100 lines per day, total runtime of less than 1 second. (by AxlLind)
Based on the code by u/supersmurfen (https://github.com/AxlLind/AdventOfCode2022/blob/main/src/bin/07.rs).
-
advent-of-code-2022
I will be attempting Advent of Code 2022 with Rust, a language I have never learned before. (by grhkm21)
[Here](https://github.com/grhkm21/advent-of-code-2022/blob/master/day-07/src/main.rs) is my implementation. I probably should create a `Tree` struct that wraps a `TreeNode` as well, but... I am kind of lazy. Note that `.dfs` doesn't allow returning any references e.g. `.dfs(|node| node)` will not work, since that runs into lifetime issues of closures, as they are not declarable. (I am beginner to Rust too, sorry for wrong termonology).
-
Went with a recursive data structure as well. Github link: Day 7.cs + Day7Classes
-
-
-
My Python 3 solution
-
Go
-
Advent-Of-Code-2022
My solutions for Advent Of Code 2022. Every day is written in another language, chosen randomly. (by Jomy10)
Today is Go
-
-
As usual, code on Github, recording on Twitch.
-
-
This comes from three unpublished crates (aoc/aoc-derive/aoc-build) that I implemented last year. You can read their source code on https://github.com/samueltardieu/aoc, and see how they are used by cloning https://github.com/samueltardieu/aoc2022.
-
This comes from three unpublished crates (aoc/aoc-derive/aoc-build) that I implemented last year. You can read their source code on https://github.com/samueltardieu/aoc, and see how they are used by cloning https://github.com/samueltardieu/aoc2022.
-
Rust
-
-
Python 3- Parts 1 & 2: GitHub. No imports, 10 lines, 362 characters including file name. Not insanely proud, as I wanted to be more concise (who needs readability), but it works.
-
But this worked for both parts GitHub.
-
-
C# straight forward going line by line, adding folders in a list, files in another and then looping through both lists to calculate size of folders (sum of all files starting with that path). GitHub
-
18 micro seconds! That's insane. I was happy at 40 microseconds although I CBA to optimise down to as_bytes shenanigans
-
My Kotlin solution: https://github.com/Dantaro/adventofcode2022/tree/main/src/main/kotlin/day07
-
-
AoC.2022
Advent of Code 2022, I'm going to try to use Excel. First with LAMBDA, then maybe VBA or OfficeScripts.
Excel VBA, just make the file system and write the files, make a collection of folder objects, and output the full path and .size of each folder. TIL that a blank line in Windows/ASCII is 2 bytes. GitHub
-
Rust solution. https://github.com/adamchalmers/aoc22/blob/main/day7/src/main.rs
-
advent-of-code-2022
Joel Eisner's completed TypeScript code challenges for "Advent of Code" 2022 (by joeleisner)
-
After I had realized that I can pattern match on slices with Rust an elegant solution (nearly) wrote itself :)
-
-
-
Overengineered but educational (for me) Haskell solution using zippers and recursion schemes
-
OCaml, pure functional. This is the interesting tree-builder part, the rest is on github.
-
Rust: https://github.com/Fektoer/advent2022/blob/main/day7/src/main.rs
-
Dlang solution, part 2. I'm embarrassed by this code but I'm sharing it because it took a lot of effort to write it. Previous solutions are available in this repo
-
Racket/Scheme
-
-
Source
-
C#: my first experience using something like trees. It was exhausting (complete solution in my repo)
-
-
Annotated code and video of it running. Running my actual input took ~7 minutes.
-
JavaScript Day 7
-
AdventOfCode2022
Repository for advent of code code to find solutions. This year in Go. (by BlaximusIV)
Solution implemented in Go, using a tree and recursion. I'm new to Go, coming from C#. I created a monster and would love any feedback to make it cleaner and more idiomatic!
-
Solution in C#
-
-
OOP Python solution
-
https://github.com/djotaku/adventofcode/blob/45ab63cf7679e1b6ce61f32a61e03da384d57295/2022/Day_07/Python/solution.py
-
-
anyway here is the link to my github
-
Kotlin solution, yeah!
-
Part 1 and 2
-
Python3. Full code. Pretty good excuse for structural pattern matching:
-
Not optimal, but needed an excuse to have "fun" with immutable trees
-
Kotlin solution with recursion and iterator for the file tree https://github.com/DDihanov/Advent-Of-Code-2022-Kotlin/blob/master/src/main/kotlin/day7/Day7.kt
-
-
Part 1
-
https://github.com/kevinluo201/aoc/blob/main/2022/day7/day7.rb Basically, I build a class to handle each directory.
-
git repo
-
My solution in Rust, I expected to have a very hard time on this and was actually pleasantly surprised that I was able to complete it in only a few hours. That being said, my solution is probably horrible
-
AdventOfCode-Day7-SpaceAnalyser
C# .NET Core console app that solves the AdventOfCode Day 7 - Space Analyser puzzle.
C# Solution using Switch, LINQ & Recursive calculation of sub-directories - nothing fancy :/. code
-
python
-
Julia 11/737, which is my best placement yet, and second ever points.
-
My solution for day 7: https://github.com/AlexanderNenninger/AoC2022/blob/master/src/days/day07.rs. I used Rust's sum types in a finite state machine for parsing input. This solutions also demonstrates how to use an explicit buffer for multiple mutating references.
-
JavaScript https://github.com/ilsubyeega/aoc2022/blob/main/day07.js \ I think this problem was a little overwhelming for me, who is graduating as a high school student soon. Hope I can refactor this in the future.
-
-
Blog Walkthrough of a Serial Solution | Late-Breaking Code for a Parallel Solution
-
Here is my code: Github
-
-
-
Here's the repo, its way too long for here!
-
-
7b Code
-
Here's my solution having all things immutable and emulating the file system using recursive types. But yes, trees are not something I do every day :/
-
Solution using tree python
-
Gitlab