Design an In-Memory File System
Medium · Low-Level Design · about 45 minutes
Asked at Microsoft, Amazon, Uber.
Design an in-memory file system. Support mkdir(path) (creating parents as needed), write(path, text) and append, read(path), ls(path) (a directory's entries in sorted order, or a file's own name), rm(path), and size(path) (a directory's size is the total of everything under it).