2022 day 7: Bash parts 1 and 2 (messy, tons of debug)
This commit is contained in:
@@ -118,10 +118,39 @@ files more than once!)
|
||||
Find all of the directories with a total size of at most 100000. /What
|
||||
is the sum of the total sizes of those directories?/
|
||||
|
||||
To begin, [[file:7/input][get your puzzle input]].
|
||||
Your puzzle answer was =1390824=.
|
||||
|
||||
Answer:
|
||||
** --- Part Two ---
|
||||
Now, you're ready to choose a directory to delete.
|
||||
|
||||
You can also [Shareon
|
||||
[[https://twitter.com/intent/tweet?text=%22No+Space+Left+On+Device%22+%2D+Day+7+%2D+Advent+of+Code+2022&url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F7&related=ericwastl&hashtags=AdventOfCode][Twitter]]
|
||||
[[javascript:void(0);][Mastodon]]] this puzzle.
|
||||
The total disk space available to the filesystem is =70000000=. To run
|
||||
the update, you need unused space of at least =30000000=. You need to
|
||||
find a directory you can delete that will /free up enough space/ to run
|
||||
the update.
|
||||
|
||||
In the example above, the total size of the outermost directory (and
|
||||
thus the total amount of used space) is =48381165=; this means that the
|
||||
size of the /unused/ space must currently be =21618835=, which isn't
|
||||
quite the =30000000= required by the update. Therefore, the update still
|
||||
requires a directory with total size of at least =8381165= to be deleted
|
||||
before it can run.
|
||||
|
||||
To achieve this, you have the following options:
|
||||
|
||||
- Delete directory =e=, which would increase unused space by =584=.
|
||||
- Delete directory =a=, which would increase unused space by =94853=.
|
||||
- Delete directory =d=, which would increase unused space by =24933642=.
|
||||
- Delete directory =/=, which would increase unused space by =48381165=.
|
||||
|
||||
Directories =e= and =a= are both too small; deleting them would not free
|
||||
up enough space. However, directories =d= and =/= are both big enough!
|
||||
Between these, choose the /smallest/: =d=, increasing unused space by
|
||||
=24933642=.
|
||||
|
||||
Find the smallest directory that, if deleted, would free up enough space
|
||||
on the filesystem to run the update. /What is the total size of that
|
||||
directory?/
|
||||
|
||||
Your puzzle answer was =7490863=.
|
||||
|
||||
Both parts of this puzzle are complete! They provide two gold stars: **
|
||||
|
Reference in New Issue
Block a user