Compute Total Size of a File System
Asked at Google · Coding Questions · Difficulty: Easy · Last asked May 31, 2026
A file system is a tree: a directory holds files and other directories, and each file has a size in bytes. Given the root node of such a tree, return the total size of all files below it. Write it twice: once in any style you like, and once without recursion so that it also works on very deep trees.
Loading the problem…
More Google interview questions
- LLM conceptual questions
- Implement a Nested Tic-Tac-Toe Game Engine
- ML Fundamentals Deep Dive (AI/ML & MLE Roles)
- Design a Real-Time Product Recommendation System
- Implement Scaled Dot-Product Attention
- Design a Multi-Tenant, Multi-Region API Rate Limiter