~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
In-memory file system
Path hierarchy as nested dicts; quotas.
Notes
Recognise it when: the OA-style "file storage / file system" problem: paths, sizes, users, quotas, backups.
- A flat dict
name -> (size, owner)is often enough. Use nested dicts only if you need directory listings. - Keep a
usedcounter per user (update it on every add, delete and merge) rather than recomputing it. - "Top n by size, then name":
sorted(..., key=lambda x: (-size, name))[:n].
Gotchas: every mutation path (delete, merge, restore) must keep the capacity counters consistent. Test that after each level.
4 problems
Practical systems
Stateful stores Key-value stores, file systems, banks, with history.
In-memory file system
- Basics: directory tree from paths basics py · c++ · java easy
- Camera card: find by extension, delete folders py · c++ · java easy
- Design In-Memory File System py · c++ · java medium
- OA: Cloud file storage 4 levels Anthropic py · c++ · java medium