Day 7: No Space Left On Device
Day 7 involves parsing terminal output to build a directory structure and calculate directory sizes.
Problem Overview
You're trying to free up space on your device by analyzing the file system. Given a terminal output showing the commands you executed and their results, you need to:
- Build a directory tree from the commands and output
- Calculate the total size of each directory (including subdirectories)
- Find directories smaller than a certain size
- Find the smallest directory that, when deleted, would free enough space
This problem tests your ability to parse structured text, build a tree data structure, and perform size calculations on it.
Navigation
- Problem Description: Detailed description of the day's challenge
- Solution Explanation: Walkthrough of the approach used
- Code: The complete implementation with comments