diff options
-rw-r--r-- | 2022/day07.awk | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/2022/day07.awk b/2022/day07.awk index 4143a8b..ddcc7b0 100644 --- a/2022/day07.awk +++ b/2022/day07.awk @@ -24,4 +24,13 @@ END { sum += dirs[dir]; } print sum; + used = dirs["/"]; + unused = 70000000 - used; + needed = 30000000 - unused; + min = used; + for (dir in dirs) { + if (dirs[dir] < needed) continue; + if (dirs[dir] < min) min = dirs[dir]; + } + print min; } |