Day 7/25: No Space Left On Device | Advent of Code 2022 Explanations

preview_player
Показать описание

Private leaderboard: 905674-cb4dca25

00:00 Intro
00:27 Timelapse
01:27 Part 1 problem statement
03:03 Part 1 solution
10:23 Part 2 problem statement
11:04 Part 2 solution
12:49 Outtro
Рекомендации по теме
Комментарии
Автор

Thanks for the explanation, it helped me understand some new concepts. While I feel like a loser for looking up a walkthrough, I still learned something new, so I guess it's not all bad.

AzbestoN
Автор

thanks so much, couldn't do it before but now feel like ive learnt so much. very clear and useful walkthrough

somurai
Автор

Dang dude, this one took me 4 hours 😅

jeffirwin
Автор

One big optimization is to add the size of each file to the current directory and all of its parents in the initial loop. That eliminates the need for the children map. I started out by filtering out all 'dir' and 'ls' lines. Only 'cd' (push/pop path elements) and actual files matter.

eavdmeer
Автор

Thanks for posting. Question re: the DFS algo. I was under the impression DFS required marking a node as visited or not. I don't see that in the code, so I s'pose my question is: Is visitation required of DFS and perhaps this implementation is DFS-like, or is the lru_cache acting as the visitation marker? Thanks again - appreciate any insight you can share. Learned a lot from this walkthrough.

its_just_me