Module aoc::y22d07

source ·
Expand description

Advent of Code 2022 Day 7: https://adventofcode.com/2022/day/7

I initially started this out by trying to make a more robust representation of the “filesystem” using custom structs for directories and files but after arguing for a little while with the borrow checker while trying to keep track of the parent directory I realized that I was over-complicating things. Instead I settled on a solution that just creates a std::collections::HashMap of full directory paths and then as it sees each file it adds the size to each of the directory components stored in the hash all the way up to the root (/) entry.

Functions§

  • The solution for the day seven challenge.