Day 7: No Space Left On Device [AOC2022 Python]

Опубликовано: 17 Май 2026
на канале: 0xdf
762
23

In this challenge, I'm asked to parse a bunch of terminal output to track how much stuff is in various directories on a file system. First I'm asked to find the sizes of all directories under a given size, and then asked to find the smallest directory that I could delete to allow a given amount of space on the disk.

Code 2022 AOC: https://gitlab.com/0xdf/aoc2022
Challenge Link: https://adventofcode.com/2022/day/7

☕ Buy Me A Coffee: https://www.buymeacoffee.com/0xdf

#adventofcode #python

[00:00] Introduction
[00:12] Part 1 description
[01:34] Strategy / input analysis
[02:58] Looping over lines, creating tokens to switch on
[04:55] Processing lines with size / file
[07:33] Running on example, noticing missing cd code
[08:47] Adding code to track current directory
[09:53] Troubleshooting path size tracking
[11:54] Calculating part 1 solution
[13:30] Part 2 desription
[14:00] Calculating size to be deleted
[15:28] Finding dir to be deleted, solving part 2
[16:12] Part 2 summary