Design a file system with mkdir, ls, addContentToFile

by drift4527
Stripe
mid
coding
medium
pending
22
130

For the coding question about designing a file system with mkdir, ls, and addContentToFile, I started sketching out the class structure. I mentioned using a tree-like structure to represent directories and files.

The interviewer seemed engaged and asked clarifying questions about how to handle file collisions and how ls would behave in different scenarios. I stumbled a bit when trying to explain how the addContentToFile function would work, especially in terms of managing the content of existing files vs.

creating new ones. We had a helpful back-and-forth on edge cases, which I appreciated.

Overall, I felt I could explain my thought process, but I was challenged on some assumptions I made about file handling, which caught me off guard.


Markdown supported