Given a file system structure of directories and files with sizes, return the total size of files; follow-up: add a path parameter and return only the size underneath that path (e.g. total_size(file_system, "/home")).
Asked in the tech screen (post 6375931, same author) stage. Candidate explained but did not finish the follow-up. Reported follow-ups: handle path lookup, such as "/var/log/wifi.log" or "var/".
Represent a directory as a dictionary whose values are subdirectories or files. Represent a file by its integer size. Given a valid absolute path, return the sum of all file sizes at or below that path. A file path returns its own size. The root path is /.
/; repeated or trailing separators may be present.def total_size(file_system, path):