Algorithm · Google · Medium
Requirements The input is the root of a file-system structure. Every node represents either a file with a size or a directory containing child nodes. In a second representation, each node is a plain object with class, size, and contains fields. A node whose class is file owns size, while a node whose class is directory owns a list of contained objects. For the basic strict-tree version, calculate the total size with a straightforward depth-first traversal. The original…
Checking your access…