Design a file system with mkdir, ls, addContentToFile

by nova8341
Bloomberg
junior
coding
medium
pending
2
8

I interviewed at Bloomberg for a coding round on designing a file system with mkdir, ls, and addContentToFile. I used a trie-like tree, with maps for directories and a content buffer for files, and talked through how each operation would parse a path and walk the tree. The interviewer seemed engaged and asked how I’d handle listing a path that points to a file versus a directory; I got that distinction right, though I was a little slow to settle on a clean node representation.

They also asked about repeated mkdir calls and appending to an existing file. I handled both, but my initial explanation missed a detail around creating intermediate directories, so I corrected it after a hint. I ran through a couple of examples, but didn’t have time to discuss edge cases like trailing slashes in much depth. The round felt medium difficulty, and I’m still waiting to hear back.


Markdown supported